"ld: library not found for -lPods" only when run in real device - objective-c

I entered the mysterious phenomenon that I can build my app for simulator but I can't build for real device. The error is as below (which doesn't appear when build for simulator):
ld: library not found for -lPods-TechMoviePlus
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(I'm using Cocoapods and attach one of my app's targets, so that the name of library is a little different.)
Project > Target > General > Linked Frameworks and Libraries is as below:
Thank you for your kindness!

Assigning the target in Podfile has resolved the problem.
target :TechMoviePlus do
pod "AFNetworking", "~> 2.0"
pod "LBGIFImage"
end

Open your pbxproj file with an editor and check for references to Pods-Application. If you renamed your application after pod install, you may have some references to the old pods.
Remove all the references to Pods-Application, launch xcode, full clean, and build.
It worked for me.

Related

Google places with objective c errors

Hello I just used pods to implement google places with my application but when I try to run my app I get this error.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GMSPlacesClient", referenced from:
objc-class-ref in ViewController.o
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)
this is my pod file:
source 'https://github.com/CocoaPods/Specs.git'
project '/Users/GeorgeYoung/Desktop/Travel/Travel.xcodeproj'
target 'Travel' do
pod 'GooglePlaces'
end
The error apears to be coming from the AppDelegate.m
[GMSPlacesClient provideAPIKey:#"AIzaSyBYRDTp7U-633XB81qsBeOiVGhokPrc6_M"];
Podfile.lock:
PODS:
- GoogleMaps/Base (2.4.0)
- GooglePlaces (2.4.0):
- GoogleMaps/Base (= 2.4.0)
DEPENDENCIES:
- GooglePlaces
SPEC CHECKSUMS:
GoogleMaps: 8436ab5d1c25e36915b2f7416d0c8e3fa2e76c61
GooglePlaces: aafe5990fa7951e98e078761bbdaaf236d7e0c65
PODFILE CHECKSUM: e564be8d79cfc6ae7b4a4a197ee6149eac7d65d2
COCOAPODS: 1.3.1
If source code for the library is available, CocoaPods is pretty good about making sure the correct architecture is built. In this case, the Google Places library is a pre-build library so there is a risk that it did not contain a slice with correct architecture. The file command can be used to check if a library contains a slice. The next possibility is that somehow the library was not included in the link. This can happen if you open the Xcode project instead of the Xcode workspace created by CocoaPods. Checking that the workspace is indeed being used and that Pod library is being linked can be used to eliminate this problem. Finally, if all else fails (and again CocoaPods usually seems to get this correct) make sure the 'Other Linker Flags' build setting contains the -ObjC setting. This is need to force the loading on some Objective-C symbols from static libraries.
So in summary
Check prebuilt libraries contain the needed slice
Make sure you're using the workspace not the project
Make sure the Pod library is included in the link
Make sure -ObjC is specified in
the 'Other Linker Flags'
You're either not linking against the library that contains GMSPlacesClient or you built the library with the wrong architecture.
Modify your pod file:
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'

ld: library not found for -lGoogleToolboxForMac

I am implementing firebase setup via pods.
My Pods file looks like following one.
# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
# $(PROJECT_DIR)/build/Debug-iphoneos/GoogleToolboxForMac lib search path
target 'ProductName' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for mCura
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
Everything is fine with iPad simulator. its running but when I run my application in iDevice. It shows library not found.
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have already wasted 2 days for removing this error & tried everything I could find on net. And GoogleToolboxForMac library automatically installs when firebase pod get installed.
I change my pod file to following code and re-install pod. It installed all necessary files for GoogleToolboxForMac.
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'ProductName' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac', '~> 2.1'
end
After Installing pod
1) Change Scheme to Generic iOS Device and Build.
2) After build success you can see libGoogleToolboxForMac.a file in black colour instead of red.
3) Now select Device and run build on iDevice. Follow screenshot.
Or you can have build library libGoogleToolboxForMac.a
I was also getting this exception:
It fixed after opening the /platform/ios folder in Xcode instead of /platform/ios/MyApp.xcodeproj file.
I got the same error and it was fixed just by opening the project from the .xcworkspace file instead of the .xcodeproj.
Sigh.
For my Cordova project I just removed plugins, platforms and node_modules, readded IOS, and double clicked instead of using alt-down to open the xsworkspace and suddenly it magically worked.
Posting this here so I remember that it might be unnecessary to look for a real solution.
This StackOverflow question: Framework not found GoogleToolboxForMac had the answer that fixed this for me, but it was not the most highly upvoted answer. I had to go to the build settings for the GoogleToolboxForMac target and change the "Build Active Architecture Only" setting from Yes to No. Then clean and rebuild.

Xcode clang error when adding SDWebImage framework

I am trying to compile an app that use SDWebImage, when I add the framework to xCode I keep getting the following error.
I have attempted to add the framework by clone the git repo
ld: framework not found SDWebImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Linking in Xcode requires a bit of work. We can tell what to do or suggest a better way. As I consider "dropping framework" solution a very bad habit, I'd strongly suggest a better way:
Use dependency manager!
This will help you to see whenever your dependencies get new updates. You'll also know which version are you using. This is a good practice.
You can eg use Cocoapods. Go to your Terminal, type:
$ sudo gem install cocoapods
Then go to your project folder (place, where you have xcodeproj) and type:
$ pod init
This creates a file named Podfile. Open it and paste:
platform :ios, '8.0' // or whatever you need
use_frameworks!
pod 'SDWebImage', '~> 3.7'
So when you have it ready, open Terminal and type:
$ pod install
From now you should work on xcworkspace instead od xcodeproj. Your dependency should work correctly.
BTW: There are many other solutions. You can simply use git submodules. You can also use Carthage. However most popular and as for me atm most convenient way is Cocoapods, so I wrote steps for this way.
You've added SDWebImage as a linked framework.
What you should be doing is adding it as an Embedded framework, and make sure that your build phase copies the framework into your app bundle.

Apple Mach-O Linker Error lxml

I just upgraded xcode to 4.5 and now i get an error when compiling :
ld: library not found for -lxml2.2.7.3
cland: error: linker command failed with exit code 1
I did not change my code after the upgrade...
So?
thanks!
Click on your projekt ☞ target ☞ build phases ☞ link binary with libraries
then remove lxml2.2.7.3.dylib and add lxml2.dylib (if your project does not depend on a specific version of that library).
For my ionic project, I found that opening the .xcworkspace instead of .xcodeproj fixed this issue

Trouble when I try to run Archive command in XCode

I'm making an app with Facebook validation. It is working fine on simulator and in the device.
But, when I try to "Archive" (Product => Archive), I get this error:
ld: library not found for -lfacebook_ios_sdk
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The libraries are okay, otherwise it would not compile on simulator/device.
I don't know if this information is relevant, but my project is an ARC project.
Does anyone know what this error could mean?
I solved the problem by just removing the "libfacebook_ios_sdk.a" reference from my Link Binary Libraries and adding it again.
I dont know why it worked, but worked!