I'm trying to integrate Localytics into my iOS app and am using cocoapods:
pod 'Localytics'
However, when I start my app (I'm not even invoking or importing the Localytics namespace yet) my app blows up with this error:
dyld: Library not loaded: #rpath/Localytics.framework/Localytics
Referenced from: /Users/bobbydavro/Library/Developer/CoreSimulator/Devices/8A21B45E-D77B-41F7-AB45-8F77DE48A4AF/data/Containers/Bundle/Application/556E667A-59D9-4072-81F1-B9CA600E0C46/MyApp.app/MyApp
Reason: image not found
I've found a number of related SO articles on this but none of the suggested fixes work:
make the linked pods binary 'optional'
disable bitcode
pod deintegrate, then re-install
I'm stuck, I also tried using Segment to integrate but it has a direct dependency on the same pod and blows up exactly the same way :/
Well, try the following:
go to Project Setting Your_Target -> General -> Embedded Binaries -> click on + button and add your library here
To use the dynamic framework with Cocoapods 1.0, you need to add the use_frameworks! statement to your Podfile.
platform :ios, '8.0'
target 'MyApp' do
use_frameworks!
pod 'Localytics'
end
This was happening to me as well. For some reason, my project didn't like their dynamic framework. (I'm not supporting iOS 7 so that shouldn't be an issue.)
My fix was to use their static framework.
pod 'LocalyticsStaticFramework'
It's likely an issue with the project settings, not their framework.
Related
I followed the instructions in https://developers.google.com/admob/ios/quick-start (I've tried twice already), but when I run my app it crashes. It seems like it can't find the FBLPromises.framework. In the project navigator that framework and some other files are in red.
At first, it wouldn't even build, but I found an article that said to set the Pod's script to run on installs only. So now it builds but crashes immediately.
The error I get is this:
dyld: Library not loaded: #rpath/FBLPromises.framework/FBLPromises
Referenced from: /Users/me/Library/Developer/CoreSimulator/Devices/9E7DEF6C-2C86-4E3C-82CF-13F2388060B5/data/Containers/Bundle/Application/70DE82B4-0792-4645-9197-07C9CE191D88/myapp.app/My app
Reason: image not found
My pod file (I removed the info for the tests and a watch extension since I only want ads on the one target):
# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
target 'My app' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
# Pods for My app
end
I tried commenting out use_frameworks! and adding something about headers on the podfile, but it didn't do anything. I also tried changing the pod path on build settings, but also nothing.
I downloaded the framework version for manual download and tried adding the missing framework, but the files seem to have different names, so I couldn't tell which file to put where.
I got this error when I ran my app on my phone
enter image description here
When I want to add the missing dynamic library, I find that the library is grayish white. Are all the libraries imported through pod like this? It means that the library is missing. I'm looking forward to your help
enter image description here
Normally you don't have to add the frameworks you installed from your podfile via pod install manually. They are all contained in the Pods framework (in your case Pods_ZSS.framework) and added to your project automatically.
Xcode now tries to add Alamofire.framework a second time and does not find the corresponding header search paths, etc. or does not know, which framework should be used.
Try the following:
Remove the additional import of Alamofire, clean build folder and build again.
If the error still occurs, close Xcode and run pod install via terminal in your project folder. This configures your Pods project and adds the dependencies to your main project for you.
Also check, if the target define in your podfile exactly matches the name of your target in Xcode. E.g. your target in Xcode is named 'SSZ', then your podfile should look something like this:
platform :ios, '<your_target_deployment_version>'
# Imports for target 'SSZ'
target 'SSZ' do
# Use dynamic frameworks
use_frameworks!
# Frameworks
pod 'Alamofire', '<specified_framework_version>'
pod '<second_framework>', '<specified_framework_version>'
pod '<third_framework>', '<specified_framework_version>'
# so on and on
end
Also remember to open the project's workspace generated after running pod install (<project_name>.xcworkspace). Otherwise Xcode will not build and integrate your frameworks when building your app. <project_name>.xcodeproj just contains your own project without the frameworks.
I'm using Cocoapods with my Xcode project, but it seems to be causing both "library not found" and header "file not found" errors when building with the Simulator but not when I have a device connected nor when using "Generic iOS Device".
My Podfile is simple. I have only one pod in there, for Microsoft's ADAL SDK, needed for single sign-on. When I use use_frameworks! in the Podfile I get:
fatal error: 'ADAL/ADAL.h' file not found
for the line
#import <ADAL/ADAL.h>
but if I use use_modular_headers! instead of use_frameworks! I get:
ld: warning: directory not found for option '-L/Users/memyself/Documents/iOS_Projects/ASSIST-main/ASSIST-main/DerivedData/MyApp/Build/Products/Debug-iphonesimulator/ADAL'
ld: library not found for -lADAL
Even if I disable both of those it builds fine for the device and for "Generic iOS Device", but fails with 'ADAL/ADAL.h' file not found error.
Yes, there are plenty of SO questions and answers for those kinds of errors (such as here) but no success trying them. To be specific, I'm using $(inherited) in the recommended search paths, setting enable bitcode to NO, making sure I'm opening the xcworkspace not the xcodeproj file, and have tried
$ pod deintegrate
$ pod clean
$ rm Podfile
Also, my app uses AWS and Firebase and I was getting the same problem with them, but was able to fix them by manually adding the necessary frameworks. However, I don't have a framework for ADAL, and frankly I need to fix this so I can use Cocoapods to install and manage my AWS and Firebase dependencies. It is very suspicious that it only fails when building for the Simulator, what project settings could cause this?
Update the deployment target and the Podfile 'platform' target. Update both from 9.0 to 11.0. Change this line in your Podfile
platform :ios, '11.0'
and this in both your Target and Project:
Try changing build active architecture only in build settings.
I am trying to upgrade my iOS app with the latest FacebookSDK. Facebook recommends the use of CocoaPods for upgrades. I was already using another 3rd party SDK that also uses CocoaPods. For the existing 3rd party SDK, it requires the use of use_frameworks! in the podFile. However, when I run 'pod update' and then build my app, I get the following errors:
Unknown type name FBSDK_EXTERN [facebook header file]
for each Facebook header file that uses this extern. How can I resolve this apparent incompatibility between podFile requirements of these two different SDKs?
My podFile looks like the following:
platform :ios, '8.0'
def shared_pod
use_frameworks!
pod 'apptentive-ios', '~> 4'
pod 'FacebookSDK'
end
target 'myApp' do
shared_pod
end
target 'myOtherApp' do
shared_pod
end
Alternatively, how can I resolve the 'Unknown type name FBSDK_EXTERN' to allow my app to build?
I also had the same problem.
I believe this can be cause by CocoaPods cache.
The best approach (and worked for me) is
go to the /Pods folder
delete the problematic framework folder (may be
named FBSDKLoginKit)
run pod install --repo-update again
if that doesn't work try resolving your pod to the previous version
pod 'FacebookSDK', '4.37.0'
Cheers
Had the same error when tried to compile FBSDKShareKit 4.38.1 with FacebookSDK 4.37.0. Updating FacebookSDK to 4.38.0 fixed this issue.
I tried Francisco's solution without success, downgraded to 4.37.0 and suddenly still got the same error (even though I had this version installed right before trying to update).
What then helped was simply cleaning Xcode's build folder, building now works for me.
I'm trying to use the new(?) CocoaPods subspec for Parse's FacebookUtils framework.
The readme for the pod says:
If you wish to use the Facebook or Twitter utils or ParseUI, you can
now leverage Cocoapods 'subspecs'
ruby
pod 'Parse/FacebookUtils'
pod 'Parse/TwitterUtils'
pod 'Parse/UI'
Note that in this case, the Parse framework will contain all headers
and classes, so you just have to use:
swift import Parse
objc #import Parse;
And importing the main Parse classes works this way. However, the subspecs FacebookUtils and UI are not recognized by the Xcode compiler!
It simply says "PFFacebookUtils" is an undeclared identifier.
Note: I am using use_frameworks! at the top of the podfile which results in Pods_PROJECT.framework in my "Link Binary With Libraries" list.
I'm kind of lost here and would really appreciate some help.
UPDATE:
I figured out that the issue seems to be my podfile section for an iMessage extension:
target 'MyApp' do
pod 'Parse/UI'
pod 'Parse/FacebookUtils'
end
target 'iMessage App' do
pod 'Parse/Core'
end
Somehow this results in a successful compilation, but a crash on startup with the error:
dyld: Symbol not found: _OBJC_CLASS_$_PFFacebookUtils
Referenced from: .../myapp.app/myapp
Expected in: .../MyApp/Frameworks/Parse.framework/Parse
When adding the FacebookUtils subspec to the iMessage extension, the crash goes away and all is well... except FacebookUtils contains references (UIApplication) that are not allowed in extensions. >:U
The crash is caused by CocoaPods script Pods-YourProject-frameworks.sh installing Parse-Core-FacebookUtils-TwitterUtils/Parse.framework and Parse-Core/Parse.framework to the exact same location, effectively overwriting the former
install_framework "${BUILT_PRODUCTS_DIR}/Parse-Core-FacebookUtils-TwitterUtils/Parse.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Parse-Core/Parse.framework"
I solved it by adding the following run script before CocoaPods run script
/usr/bin/sed -i '' '/Parse-Core\/Parse.framework/d' "${PODS_ROOT}/Target Support Files/Pods-YourProjectName/Pods-YourProjectName-frameworks.sh"
This removes the offending lines from CocoaPods script and solves the crash.
Note: remove -Core part that if you use pod 'Parse' instead of pod 'Parse/Core'.