Xcode: library not found for -lPods - ios

Having a react-native project, which won't build on target "Staging" since I've setup cocoapods and using xcworkspace file since then (needed for firebase integration of react-native-firebase). When trying to build for taget "staging", I'll get this error:
ld: library not found for -lPods-[app]
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It works on debug, and (well at least it doesn't throw an error) when I archive the project.
I've having a "staging" target because of code-push. Using react-native at version 0.48.4 and Xcode 9 (created it following this guide, but before using cocoapods)
My podfile:
platform :ios, '9.0'
target 'xx' do
#use_frameworks!
# Pods
pod 'Firebase/Core'
pod 'Firebase/Analytics'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
end
Tried with and without use_frameworks!, cleaning project, deleted DerivedData, deintegrating and reintegrating pods.
What could cause this? (Please tell me if you need more information)

What worked for me:
Deintegrated all pods using pod deintegrate (using enter link description here)
pod install
Removed [Project name] > Frameworks > Pods_[Project name].framework (which was red, but there are actually more files being red)
Build succeeded
Was doing this with the help of this post. Thanks also to Maurice for trying to help me.

I had this issue. In my case it was a react-native app added Firebase Analytics. As of July 2018, all apps must be built with iOS 11 per Apple: developer.apple.com/ios/submit/
Once I went to my General tab and scrolled down to Deployment Info / Deployment Target and changed it from 10.x which is what I was targeting, to 11.x - the app built/archived and I was able to submit.

Set your PODS_CONFIGURATION_BUILD_DIR of "staging" as "release" ${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME).
Check the Frameworks folder and remove red files.

check whether the SEARCH_PATHS is correct at Pods-XXXX.debug.xcconfig or Pods-XXXX.release.xcconfig
LIBRARY_SEARCH_PATHS = $(inherited) "$(PODS_ROOT)/path/to/your folder"

Related

Xcode Error: "ld: framework not found..."

I've got an iOS project on Xcode that uses Firebase, which was downloaded through Cocoapods. Everything was working fine - running on both simulators and devices - until I tried to run the app on an iPad 7th generation simulator and this error was thrown:
ld: framework not found GoogleAppMeasurement
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Now the project won't build on any device or simulator. I navigated through the Pods folder to check if GoogleAppMeasurement had its framework and it does. Besides this one error, there's no frameworks highlighted in red (like some other related questions mention) or other indication of what could have gone wrong.
Here's my pod file in case it helps:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'my project's name' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for my project's name
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Core'
end
This same error has popped up on another one of my firebase-reliant projects and I've had no luck getting rid of it there either. Any suggestions on how to keep troubleshooting are welcome.

framework not found FirebaseCore

I am getting the following error
ld: framework not found FirebaseCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried all the things, like cleaning, reintegrating and updating and installing the PODS, nothing seems to work. Please help. Here is my PODFILE. I have been struggling for the past 2 weeks with this crazy thing
target 'MyProject' do
use_modular_headers!
# use_frameworks!
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'SwiftKeychainWrapper'
pod 'FBSDKCoreKit', '4.35'
pod 'FBSDKShareKit', '4.35'
pod 'FBSDKLoginKit', '4.35'
pod 'GoogleSignIn'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'Firebase/Crash'
pod 'FirebaseStorageCache'
end
If you look at the workspace in Xcode but cannot drill into the project from there then your issue is that your workspace is not opening properly. There should be an expand arrow next to the project name in the workspace explorer. In my case it was because the Project file was being opened by Xcode first before it was opening the Workspace. Since the project was already in use it could not be used again by the workspace. There is no appropriate error message to alert you to this situation.
To fix:
Open xcode
Close all projects and workspaces
Close Xcode (Now the next time you open Xcode it will not open your old project first by default)
Open the Workspace file
Now you should be able to drill into your Xcode project from within your workspace.
I wrestled with this problem as a noob to CocoaPods and Analytics and working with Workspaces. I had added CocoaPods and Firebase to an existing application that had not used CocoaPods before. Once you add CocoaPods you should only ever open the Xcode project through the Workspace.
FWIW: I found this link useful to understand what was going on: Xcode Project vs. Xcode Workspace - Differences
Try it to do by Changing the deployment target to iOS 11. It worked for me.

Cocoapods project settings issues

I seem to have a issue with my project settings, in Xcode 8. The issue is as follows:
When adding a new Pod - lets say, Pod Firebase - the install works, and adds the necessary files to my project. I can then, do #Import Firebase
All is fine, up to this point. However, as soon as I make a reference to the Firebase API example: [FirApp configure]; - all is still fine - autocomplete on Xcode works as expected and no issues. However, when building I then get a compile time issue which states:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRAppIndexing", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The only way I am able to solve this - is by manually adding the _FIRAppIndexing.framework in my projects, Build settings, under Link Libraries with Libraries
To do that, I just drag and drop the frame work from the project navigator to the correct section under link libraries.
This works sometimes; as with other parts of the Firebase SDK, I get runtime crashes.
So, to try get to the root cause, I created a brand new test project, installed the Pods using Pod install - I however did not have to add the framework manually to Libraries - its actually not even listed there.
Everything in the test project worked just fine, at compile and run time.
Which leads me to believe its something in my project settings that's causing this.
Things I have tried
Removed cocoapods completely with pod deintegrate and removed all
other traces of it. Then did a clean build. Then Pod install
Added -objc to linker flag
Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Crashlytics'
pod 'AsyncDisplayKit', '>= 2.0'
pod 'Firebase'
pod 'Firebase/Messaging'
pod 'FBSDKCoreKit'
pod "HockeySDK", :subspecs => ['AllFeaturesLib']
pod 'Fabric'
pod 'FirebaseAppIndexing'
pod 'AFNetworking', '~> 3.0'
pod '1PasswordExtension', '~> 1.8.4'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
GitHub example project
https://github.com/TanderZA/MyApp
I duplicated my current project - and removed all files. Problem still exists. You will see the project won't compile due to linker errors, with references to the Firebase AP.
By manually adding the frameworks to Link Libraries with Libraries, you will see that it should compile. But that is not how it should work. The current project has an issue with infoPlist.strings that I did not solve. But the project is in the state to demonstrate the issue.
I have checked the project, it seems you have messed up with schemes.
Create a new scheme properly then install the pods again and as the project is in Obj-C you don't need to enable frameworks in the podfile.
So comment like # use_frameworks!
Also update the pods using pod update
Then select the new scheme and build the project in it.
Let me know if you are not able to do it.
It is a xcode bug by the way
But try this :
Upgrade to latest version of xcode and Pods
Remove all architectures in your project
Clean your project
Add arcitectures from start.
This should resolve the issue.
Have you tried to use frameworks?
# platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
I am not sure though but I think what you need is pod 'Firebase/Core'. not pod 'Firebase'.
This link have the list of the Firebase framework that can be used.
And, in the video on the top of the page it says something about there is no single pod that can be installed and you need to set each one of them on the podfile depending on the features you want.
My guess they mislead us in some places where they had pod 'Firebase'. I dont think that they meant that it should do the work.
som try the following:
# Pods for MyApp
pod 'Firebase/Core'
pod 'Firebase/Messaging'
.
.
I know that you said that you had it work on another new project.

ld: framework not found after pod install

I added Firebase libraries to my project, and then I got this error. When I compile it, Xcode can't find some directories. However, they are in the Pods directory.
Here is the error log:
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ToDoTogether' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
# Pods for ToDoTogether
end
Make sure you are opening the workspace file and not the project file. I was receiving the same error and realized I was using the project not the workspace.
I was facing same issue and I tried multiple things but still it was not working. I tried below.
Using XCworkspace file
Cleaned the project, restarted XCode, Mac
Turned bitcode to No
Deleted the search path for Framework, Library
Finally the thing that worked is, deleting pod file and re-creating pod file. It worked as magic!
P.S.: This is very generic error and so same solution may not work for all.
Go To Project Target > Build Settings:
Look for Search Paths > Framework Search Paths, delete all paths which you have been warned; then in Library Search Paths, delete all paths which you have been warned.
For me i had to change/edit the schema and choose the new one.
I had renamed my debug schema to debug(development) and that was causing my problem.
Fix:
Product > Edit Schema > Change Build Configuration
What I did was create alternate Configurations and renamed my current one.
In my case I just had to go to Edit Scheme > Run and Reselect "None" as Executable.

GoogleMaps target doesn't get created in Pods project

System information: Xcode 7.0.1 w/ iOS 9
The issue i am having is: After adding the GoogleMaps pod (1.10.3) to my podfile, the application builds in Xcode for the iOS Simulator, but not for a device.
The error that occurring is as follows:
ld: '/Users/<username>/Projects/Arsenal/LitterBug/Pods/GoogleMaps/Frameworks/GoogleMaps.framework/GoogleMaps(GMSCachedTile.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Every post I have found mentions setting the ENABLE_BITCODE flag to 'No' for the pod target in the Pods project. That would be a viable option, if only to allow development to continue until Google updates the SDK, if the GoogleMaps target was being created in the Pods project.
My current podfile looks like:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'AppName' do
pod "Parse"
pod "SwiftOverlays"
pod "FBSDKCoreKit"
pod "GoogleMaps"
pod "FBSDKLoginKit"
pod "FBSDKShareKit"
end
target 'AppNameTests' do
end
When i run pod install --verbose or pod update --verbose, the 'install targets' phase appears to NOT install the GoogleMaps target in the Pods project. This is indeed confirmed by viewing the project in the workspace.
There IS a target created along-side the other pod targets called 'Pods-appname'. I've tried disabling bitcode for this target, but it did not fix the issue.
If anyone else has experienced this issue, please let me know. The original error i received is currently being tracked as an issue and can be viewed here: GoogleMaps issue 8219
The current workaround requires a GoogleMaps target existing in the Pods project in the workspace.
I solved this problem by Setup Enable Bitcode = NO in Build Settings.
Project>Build Settings>All>Build Options>Enable Bitcode = NO
Just select Pods in PROJECT and set Use Legacy Swift Language Version to YES.

Resources