Recently I upgrade xcode to 8.0. Since I am using swift2 when I load my previous project xcode will prompt a dialog to migrate my current code to swift2.3. After doing this, my project failed to run on the iphone device. It works fine on simulator. Below is the error I got when running on a device.
dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire
Referenced from: /var/containers/Bundle/Application/29C6F6B8-4CFB-4D1D-864E-45FF6AB13971/cooltoo_go2nurse_ios.app/cooltoo_go2nurse_ios
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/29C6F6B8-4CFB-4D1D-864E-45FF6AB13971/cooltoo_go2nurse_ios.app/Frameworks/Alamofire.framework/Alamofire: code signing blocked mmap() of '/private/var/containers/Bundle/Application/29C6F6B8-4CFB-4D1D-864E-45FF6AB13971/cooltoo_go2nurse_ios.app/Frameworks/Alamofire.framework/Alamofire
I have searched the similar error and tried below suggestions but none of them solve my problem.
In build phase, I added "Copy Files" phase then add Alamofire.framework with Frameworks as the destination, then checked 'Code Sign Copy'.
Set $(inherited) #executable_path/Frameworks on Runpath Search Paths in Build Settings.
In General tab, add Alamofire.framework in Embedded Binaries.
Below is my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
target 'cooltoo_go2nurse_ios' do
pod 'IQKeyboardManager', '4.0.5'
pod 'IQKeyboardManagerSwift', '4.0.5'
pod 'MJRefresh'
pod 'SDWebImage', '~>3.7'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'Alamofire', '3.5.0'
pod 'CryptoSwift', :git => "https://github.com/krzyzanowskim/CryptoSwift", :branch => "swift2"
pod 'Pingpp', '~> 2.1.4'
use_frameworks!
end
target 'cooltoo_go2nurse_iosTests' do
end
target 'cooltoo_go2nurse_iosUITests' do
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
Does anyone know how to fix this issue?
Thanks
I second this. Here is what I know so far. There seems to be a signing issue. My issue with this was preceded by a ridiculously slow COPY PODS script, looking at the console I was seeing signing errors all over the place. I logged into a fresh account on my computer and was able to get things running right again. Once I logged back into my original account everything came to a screeching halt. I've tried blasting my keychain, re-installing everything imaginable, and nothing is working thus far. I'm on the 8.1 GM, which is when this all started.
--- Edit 10/26/16
I determined that this was a corruption of my signing certificates in combination with something wrong with the keychain, or changes to the keychain being registered with the system. In order to fix this I did a clean install of macOS and restored my files through iCloud rather than from a time machine backup.
I still don't know what caused it but I do know that even with my keychain completely deleted and NO certificates on my computer that Xcode was installing and trying to run on the device. Ultimately the error means that the code is not properly signed so it won't allow the library to be copied and run.
Related
I'm developing a cocoa touch framework and I'm importing "RealmSwift" using CocoaPods. The project builds successfully but the tests fails to load.
I'm getting the following error:
xctest (97035) encountered an error (Early unexpected exit, operation
never finished bootstrapping - no restart will be attempted.
(Underlying error: The test runner failed to load the test bundle.
Executable cannot be loaded for some other reason, such as a problem
with a library it depends on or a code signature/entitlements
mismatch.))
Crash log:
2019-02-27 17:35:44.197599+0400 xctest[12408:121075] The bundle “MyFrameworkTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2019-02-27 17:35:44.197835+0400 xctest[12408:121075] (dlopen_preflight(/Users/zakaria/Library/Developer/Xcode/DerivedData/MyFramework-cltpexonmtkefveximwygxbkkcrj/Build/Products/Debug-iphonesimulator/MyFrameworkTests.xctest/MyFrameworkTests): Library not loaded: #rpath/Realm.framework/Realm
Referenced from: /Users/zakaria/Library/Developer/Xcode/DerivedData/MyFramework-cltpexonmtkefveximwygxbkkcrj/Build/Products/Debug-iphonesimulator/MyFrameworkTests.xctest/MyFrameworkTests
Reason: image not found)
I tried every solution I could find online, but to no avail.
It's worth mentioning that this works successfully in a iOS project, the problem occurs only in a cocoa touch framework.
My podfile is as follow:
target 'Framework' do
use_frameworks!
pod 'RealmSwift', '~> 3.13.1'
target 'FrameworkTests' do
inherit! :search_paths
end
end
I'm using Xcode version: 10.1
and CocoaPods version: 1.6.0
Go to your test logs in Derived data folder:
~/Library/Developer/Xcode/DerivedData/APP_BUILD_FOLDER/Logs/Test
You will find a .xcresult test result bundle, right-click it and choose Show package contents and in 1_Test/Diagnostics folder, you should find run/crash log for your tests.
This log will give you an exact cause of your fail, you can post it here if you don't know what to do with it after you find it, we will help you :-)
Without this log, cause of your issue could be literally anything, since this is rather generic xcbuild fail message.
This is the podfile that worked for me:
platform :ios, '11.0'
def shared
use_frameworks!
pod 'RealmSwift', '~> 3.18.0'
end
target 'Framework' do
shared
end
target 'FrameworkTests' do
shared
end
Oky, thx for logs this should fix your issue:
target 'Framework' do
use_frameworks!
pod 'RealmSwift', '~> 3.13.1'
target 'FrameworkTests' do
inherit! :search_paths
pod 'RealmSwift', '~> 3.13.1'
end
end
You don't have the RealmSwift library installed for your test target in pods, only for your app, as you can tell from log:
...Library not loaded: #rpath/Realm.framework/Realm referenced from...MyFrameworkTests.xctest...
Add code above to your podfile and run pod update :-)
Similar modification helped me.
use_frameworks!
target 'Framework' do
pod 'RealmSwift', '~> 3.13.1'
end
target 'FrameworkTests' do
pod 'RealmSwift', '~> 3.13.1'
end
Feel free to use "def" link
I encountered this issue recently when attempting to run our UI Tests target after our min deployment target was updated from 11.0 to 13.2, which failed immediately on launch. Oddly enough, updating the target all the way up to 12.4 worked just fine, but anything >= 13.0 resulted in the error
The bundle "MyAppUITests" couldn't be loaded. Try reinstalling the bundle.
The single change that resolved it (beyond ensuring that deployment target was set consistently across all targets, and in the Podfile) was to clear out the value we had listed in the BUNDLE_LOADER Build Setting within our UI Test Target.
Before:
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp";
After:
BUNDLE_LOADER = "";
I'm using Firebase in My App, I used it via pod and everything was work correctly,
Then we Add Today Extensions (2 extensions) to our app, and also we need to use Firebase in it, so I added it to podfile like this:
use_frameworks!
project ‘projectName.xcodeproj'
target ‘appName’ do
pod 'Firebase/Core'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
target ‘todayExtension1_Name’ do
pod 'Firebase/Core'
end
target ‘todayExtension2_Name’ do
pod 'Firebase/Core'
end
and I create two apps for the todayExtensions, and implement the .plist files correctly and the app build successfully.
but when I try to run the app, I got this runtime exception:
dyld: Symbol not found: _OBJC_CLASS_$_GTMLogLevelFilter
Referenced from: /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/appName
Expected in: /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac
in /Users/rawanal-omari/Library/Developer/CoreSimulator/Devices/33A7DC45-EFD9-4245-8989-7C6B4194481F/data/Containers/Bundle/Application/84C060C2-A4AE-4AF3-8804-ADA8CFBCABB3/appName.app/appName
Did anyone face problem like this?
Not sure if targeting the extensions via pods is enough,
But the following steps are needed
Step 1. Go to your firebase console.
Step 2. Click on the project you are working on.
Step 3. Within the project, click on "Add another app"
Step 4. Select iOS and then enter the BUNDLE ID of your TODAY EXTENSION
Step 5. Complete the wizard and download the generated GoogleService-Info.plist file. Add the plist file to your Today Extension's root folder
From here you can try adding firebase via pods to your extensions.
I had the same problem. In my case I've added the 'Firebase/Performance' pod to the app target, but not to the extension target. After adding it to the extension too, I was able to run the app again.
Conclusion: add the Firebase pods you're using in your app target, to the extension target too
Strangely, I can't seem to get Archive to work in XCode but the build succeeds without the errors on duplicate symbols if I do not attempt to Archive but simply build a release version. The project builds properly on devices as well.
I have searched up on this topic and tried disabling testability, and setting the 'No Common Blocks' in the project settings to NO as well but no luck so far.
The Project is a React Native 0.40 based project with CocoaPods installed as well. PodFile is this
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'StreetSmart' do
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
# when not using frameworks we can do this instead of including the source files in our project (1/4):
# pod 'react-native-maps', path: '../../'
# pod 'react-native-google-maps', path: '../../' # <~~ if you need GoogleMaps support on iOS
end
XCode Version is 8.2.1, and the project file is opened via .xcworkspace since pods are installed.
Would really appreciate any help or insight on this, been stuck at this for hours.
So I did even more research into this and the workaround is actually much simpler. Or at least it was in my case. The problem is that when you declare React in the podfile, the Pods xcodeproject gets a React target as part of the pod install process. Having this target in the Pods project is what causes the error when you Archive. So the fix is to remove the target.
The problem with removing the target in xCode is that this actually edits project.pbxproj file within the Pods folder which is not in version control. So while the build will archive once you do this, if you deploy from anywhere other than the machine that manually removed it, it will still fail. So the solution is to add this post install command to the bottom of your podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
This simply loops through all the pods to be installed and removes the target for the React one. This way anywhere that builds the project, will also remove the target. Now when you build to Archive it will not fail.
Finally solved the problem after finding a relevant issue on another react-native project here.
The answer is that there is two copies of React Native in the Xcode project, one from CocoaPods and another as a subproject. Just remove all modules that were already declared in Podfile under the Libraries inside Xcode and the error goes away after a clean and re-try.
What's interesting about this issue is that all builds in Debug and Release works but it fails when attempting to Archive the project for distribution.
[Update 2 May 2017]
The solution I described above can cause debug-time errors when you run your code with react-native run-ios/android though it allows the project to be successfully archived.
An alternative method is to remove those duplicate modules that exist both in Libraries and Podfile from the Podfile declaration instead of the Libraries folder. And of course run the relevant pod commands, clean your project etc.
Doing this allowed my code to archive and also run without debug-time errors
I solved this issue by the following:
(ref.: https://github.com/react-community/react-native-maps/issues/718)
Open Xcode > Pods > Targets Support Files > Pods-{TARGET-NAME} find
"OTHER_LDFLAGS" and remove only -ObjC in these two files:
Pods-{TARGET-NAME}.release.xcconfig e
Pods-{TARGET-NAME}.debug.xcconfig
Go to project main target > Build
Settings > Other Linker Flags: Make sure no -ObjC is left in the
value I deleted the build/Build folder in ios and run your project again.
It works now.
Side effects from the link above: the app may become larger as there may be duplicated symbols in it.
Hope it can help you.
I've run into a problem with Xcode (using Swift) that has me completely stumped. I realize that this question has been asked and answered, but none of the answers have worked for me, and my situation seems to be a bit different than the others, as all of my pods are failing (not just a specific one). They all worked fine a week ago.
I use Cocoapods for some of the more common Swift frameworks (e.g. Alamofire, Eureka, Kingfisher, SwiftyJSON, etc.). They were all working fine in Xcode 7. However, one of the (automatic) updates bumped up my Xcode version, after which it became mandatory to specify your target in the podfile. I did this and ran pod install. The pods are all still there, but now every import statement that relates to these frameworks fails.
At first I thought it was an Alamofire issue, as that's the first one that failed with the "No such module 'Alamofire'" error. I tried everything I could with Alamofire, including the following:
Clean and rebuild
Clean build folder
Restart Xcode
Re-boot computer
Delete all derived data
Added framework to "Linked Frameworks and Libraries"
Added framework to "Link Binary with Libraries"
Verified that I am opening the workspace rather than the project
Re-installed CocoaPods
Re-installed Xcode ver 7.3.1
Nothing would remove the "No such module ..." error. Finally, I removed Alamofire from the pods and just dragged the Alamofire project into my project. This allowed me to remove the import statements for Alamofire. However, to my dismay, now the next framework caused "No such module". I moved the next three frameworks into my project, and it looks like it is just going to keep going. Apparently, none of my Pods frameworks are being recognized anymore. I installed Xcode 8 and tried that with Swift 2.3, but I get the same "No such module" errors.
I really would prefer to use Cocoapods, as it makes upgrades a lot easier, along with other bonuses. I'm guessing I have some setting wrong that is screwing up all my pods, but have not had any luck finding it. This is a bit of a disaster as it has shut down development for several days, with no sign of a fix. If there is anything I can do or provide to assist in finding a solution, just let me know. If anyone could provide any possible solutions or even things to try, it would be greatly appreciated. I'm currently working with Xcode version 7.3.1.
My pod file looks something like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'Y2GOsp' do
use_frameworks!
# Pods for Y2GOsp
pod 'Alamofire', '~> 3.0'
pod 'AlecrimCoreData', '~> 4.0'
pod 'Kingfisher', '~> 2.4'
pod 'Eureka', '~> 1.6'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'PhoneNumberKit', '~> 0.1'
pod 'PKHUD'
pod 'Dollar'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.2'
end
end
end
Comments from #l'L'l led me to the solution. I went to
build settings > frameworks search path
and set it to the following:
$(inherited) (non-recursive)
$(PROJECT_DIR)/build/Debug-iphoneos (non-recursive)
$(SRCROOT) (recursive)
It is now correctly finding the pod frameworks.
Make sure you opened the .xcworkspace file in Xcode and not just the .xcodeproj file.
In Pod file
Uncomment below lines to define a global platform for your project
platform :ios, '10.0'
use_frameworks!
Now in xcode
a) Clean your project
b) Make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO"
c) Now, build project
Sometimes pod deintegrate and then pod install helps me as well
try to make the version of your SDK into earlier versions
pod 'Alamofire', '~> 3.0'
pod 'AlecrimCoreData', '~> 4.0'
pod 'Kingfisher', '~> 2.4'
pod 'Eureka', '~> 1.6'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'PhoneNumberKit', '~> 0.1'
pod 'PKHUD'
pod 'Dollar'
for example change 3.0 to available previous version, it worked once for me when i was facing the same issue.
pod 'Alamofire', '~> 2.4' #I am assuming prev available version is 2.4
But it doesn't have to be the "Alamofire" version result in "No such Module", you may try every one in your list in the pod file.
I had the same problem and I just solved it by making sure that my "Find Implicit Dependencies" is checked. Go to Edit Scheme -> Build. Previously I uncheck this so my xCode will run a little bit faster. Never realized that it will later throw me this error.
Although the question is long time ago, "no such module" error made me in Xcode 13 struggle for 3 days. I found many different solutions here, but still cannot fix it. Until I tried applying different solutions together and found my own solution.
My issue is that I can build the app on device, but shows "no such module" when building it on simulator. It seems there is something wrong while building pods.
Therefore, I added use_frameworks! & use_modular_headers! in Podfile.
target 'Application' do
use_frameworks!
use_modular_headers!
pod 'ChameleonFramework/Swift', :git => 'https://github.com/wowansm/Chameleon', :branch => 'swift5'
pod "BSImagePicker", "~> 3.1"
pod 'FirebaseCoreInternal'
I also changed the Build Setting of the Pods to exclude building pods in architecture of arm64. I did the same in my Project and Target's Build Settings.
Image of Pods' Build Settings
Please note that if you install new pod to the project, the Build Settings of Pods will be reset. You need to mannaully change back to exclude arm64.
For me the problem was that I updated the name of a build configuration within my project, but I didn't select the new build configuration in the scheme that used that build configuration. Updating the build configuration within the scheme to the new name fixed the issue!
You should excluded Architecture to nothing, also I did run the pod install command to install the pods.
Here is my podFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Everythig has been working fine for a long time, but now, when I update my pods (pod update) these 3 pods get uptated:
AFNetworking
CocoaAsyncSocket
IQKeyboardManager
After that, nothing works anymore.
I get more than 600 duplicate symbols for architecture i386 errors, like this one:
duplicate symbol _OBJC_IVAR_$_AFHTTPRequestOperation._responseSerializer in:
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libPods-AFNetworking.a(AFHTTPRequestOperation.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/MyProject-emjexnnjljambodthokzwpwcddhz/Build/Products/Debug-iphonesimulator/libAFNetworking.a(AFHTTPRequestOperation.o)
... (661 times the same error but pointing to different duplicated files)
ld: 661 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas?
EDITED: After doing the solution shown below, my project only compiles for iPad Air and I can not Archive anymore, i still get the same error...
I use the 'Manually Rename All of the Symbols' approach. I was experiencing the duplicate symbol _OBJC_METACLASS_$_PodsDummy_Pods and so i added the post_install in the Podfile to avoid the duplicate symbol.
Replace your pod file content with this to 'Manually Rename All of the Symbols'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited), PodsDummy_Pods=SomeOtherNamePodsDummy_Pods'
end
end
end
pod 'AFNetworking'
pod 'ODSAccordionView', '0.4.4'
pod 'IQKeyboardManager'
pod 'NYXImagesKit', :git => 'https://github.com/Nyx0uf/NYXImagesKit.git'
pod 'PEPhotoCropEditor'
pod 'CocoaAsyncSocket'
pod 'PKRevealController'
pod 'Haneke', '~> 1.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'RadioButton'
Edited :
Delete the following pod item's from your project
1.Pods Folder
2.Podfile.lock
3.ProjectName.xcworkspace
And then install the pods again
This hook allows you to make any last changes to the generated Xcode
project before it is written to disk or any other tasks you might
want to perform.
Reference -
1. https://developerinsider.co/cocoapods-remove-duplicate-symbols-errors/
2. http://guides.cocoapods.org/syntax/podfile.html#post_install
Even after deleting my pods and reinstalling them, I had always the same problem.
I finally found the solution by comparing with another project.
The issue was in the parameter "Other Linker Flags" (OTHER_LDFLAGS) in the Build Settings of the project. The pods were referenced not just by their name, but by adding the prefix "Pods-myProject"
"-l\"Pods-myProject-AMSlideMenu\"",
"-l\"Pods-myProject-CocoaLumberjack\"",
"-l\"Pods-myProject-DLAlertView\""
So I just removed the prefix and all was right
"-l\"AMSlideMenu\"",
"-l\"CocoaLumberjack\"",
"-l\"DLAlertView\""
I fixed a similar error (after a messy Cocoapods upgrade) by simply removing and then re-adding the pods. Backup your project, then run:
pod deintegrate
pod install
In my case we had a project written in objective C and swift with a custom framework module inside and to solve the symbols duplication problem we had to remove all the flags from Other Linker Flags under Build Settings of the project and the framework module.
Before inside Build Settings:
OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-all_load" );
After inside Build Settings:
OTHER_LDFLAGS = "$(inherited)";
I think Cocoapods has a bug where pod source files can be accidentally duplicated.
My project was building fine until after performing one pod update at which point a duplicate symbol error appeared.
After lots of confusion, I finally noticed that a Google pod ended up with two files. In my case, it was GTMOAuth2SignIn.m and GTMOAuth2SignIn 2.m. Hence, the duplicate symbol error.
Note that pods seem to reference files by wildcards indicating all source in a directory should be included. This differs from a classic Xcode project where files are explicitly referenced.
Also, I suspect that performing a pod update during a build process could be what's tripping up Cocoapods. The concurrent access to the same file(s) may cause problems. Just a theory.
Also, this may explain why some "solutions" associated with this problem are to remove/delete referenced pods, then re-add.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag the offending repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.