AdMob for iOS missing frameworks errors - ios

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.

Related

dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire Referenced from:

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.

Google NearbyMessages cocoapod generates “duplicate output file” error

I’m having a problem with NearbyMessages in Xcode 11.2. When I add pod 'NearbyMessages' and then do pod install, when I open the xcworkspace, I get a “duplicate output file” error resulting from the Assets.car that is generated by “[CP] Copy Pods Resources” build phase:
warning: duplicate output file '/Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Products/Debug-iphonesimulator/NearbyDemo.app/Assets.car' on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Intermediates.noindex/NearbyDemo.build/Debug-iphonesimulator/NearbyDemo.build/Script-EB8FCF95DAAD8AF429AAA51F.sh (in target 'NearbyDemo' from project 'NearbyDemo’)
I’ve searched and found old issues, e.g., Google Nearby Messages API Broke App Icon, that seem like they might be related. That post looks like it might be an earlier manifestation of the same problem with assets and NearbyMessages, but it looks like the old compiler may not have caught this error.
In Xcode 10.3, this is merely a warning:
ignoring duplicated output file: '/Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Products/Debug-iphonesimulator/NearbyDemo.app/Assets.car' in shell script build phase '[CP] Copy Pods Resources'. This warning represents an extremely serious project misconfiguration and will likely cause some shell scripts in your project to be skipped entirely, leading to other build failures or missing files in the build directory. This will be a hard error in the future. (in target 'NearbyDemo’)
Does anyone know of anyway to resolve this? I can downgrade Xcode, probably letting this problem pass without a hard error, but that’s not a terribly appealing solution.
It probably isn’t relevant, but here’s my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'NearbyDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for NearbyDemo
pod 'NearbyMessages'
end
I’m using Cocoapods 1.8.4 and Xcode 11.2 (11B52) on macOS 10.15.1.
I’ve posted a “Nearby Messages API for iOS - Product feedback” report, but was wondering if anyone has found a workaround in the interim.
After some searching, I found a workaround that should help with this behavior. You can achieve this by changing Xcode settings to use the old build system.
Xcode / File / Workspace Settings / Build system / select "Legacy
Build System"
If you need further information, check out this link
- https://github.com/CocoaPods/CocoaPods/issues/8122

Pods with multiple targets getting error?

Alright, Ive seen this problem in a lot of places but I cant find a clear solution - they all seem to be pretty convoluted. I am trying to add pods to a Message Extension. I get this error when doing the following and running pod install - this happens as soon as opening and trying to run the workspace:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'LaunchPack' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for LaunchPack
pod 'lottie-ios'
end
target 'MessagesExtension' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MessagesExtension
pod 'lottie-ios'
end
Here I pod to both targets and per solutions like https://www.bountysource.com/issues/35748866-missing-embed-pods-build-phase-for-messages-extension-target I have manually added the library (Lottie) to the Link Binaries with Libraries section of BOTH targets:
The link above describes "The issue can be fixed by ensuring that the framework is weakly linked and manually adding a "Run Script" build phase for the -frameworks.sh script"
however I don't understand what they mean by that. Where I can I link the framework other than where I have already?
How can I add pods to my MessageExtension?
I have faced the same issue when adding pods for multiple targets what I did was uninstalled and deleted all the pods file first. Then create multiple targets and after that add the pod file and installed it and works fine for me.

Localytics causing crash due to image not found

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.

Cocoapods Completely Broke

To start: I'm using Cocoapods 0.37.2, XCode 6.3.1 compiling for iOS 8.3
My project worked just fine before I ran a basic "pod update" now it's completely refusing to compile. I'm quite positive this has nothing to do with the pods themselves. Specifically the error I'm getting is this:
ld: warning: directory not found for option '-F/Users/user_name/Library/Developer/Xcode/DerivedData/AppName-bjozswzeepmhacfkeimeepxzcxgb/Build/Products/Debug-iphoneos/include'
ld: library not found for -lPods-AppName-AFNetworking
Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, "8.0"
def shared_pods
pod 'SocketRocket'
pod 'AFNetworking'
pod 'DateTools'
pod 'Spotify-iOS-SDK'
end
target "AppName" do
shared_pods
end
target "AppNameTests" do
shared_pods
end
I have cleared DerivedData (many many times), cleaned my builds, restarted XCode, restarted my machine, I have ensured my config files and linker config lists are set up correctly. I've been using Cocoapods for years and never had this much trouble.
Completely frustrated and confused... questioning sanity.
Any help?
Information from CocoaPods troubleshooting doc. Hope this helps you.
If Xcode complains when linking, e.g. Library not found for -lPods, it
doesn't detect the implicit dependencies:
Go to Product > Edit Scheme
Click on Build
Add the Pods static
library, and make sure it's at the top of the list
Clean and build again
If that doesn't work, verify that the source for the spec you
are trying to include has been pulled from GitHub. Do this by looking
in /Pods/. If it
is empty (it should not be), verify that the
~/.cocoapods/master//.podspec has the correct git hub url
in it.
If still doesn't work, check your Xcode build locations
settings. Go to Preferences -> Locations -> Derived Data -> Advanced
and set build location to "Relative to Workspace".

Resources