25
votes

I just upgraded to OS 10.10 Yosemite and Xcode 6 and am having trouble getting my iOS app with CocoaPods dependencies to build.

After doing a clean and build I get an Apple Mac-O Linker Error as shown below

Ld /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList normal i386
    cd "/Users/nick/Dropbox/ToWatchList/ToWatchList App"
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App/Pods/CrashlyticsFramework -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App -filelist /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-AFNetworking -lPods-AuxRepo -lPods-CrashlyticsFramework -lPods-Reachability -lPods-SSKeychain -lPods-SVProgressHUD -lPods-Tapstream -framework CoreGraphics -framework Crashlytics -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -lz -lPods -Xlinker -dependency_info -Xlinker /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList_dependency_info.dat -o /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList

ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems to have something with the OTHER_LDFLAGS (Other Linker Flags) on my project because if I reorder my pods by going to my application target -> Build Settings -> Other Linker Flags and reorder the items on that list, I can get other pods to generate Linker Errors in the same way (so at least it's not a problem with AFNetworking). Cocoapods and Xcode are not generating any other errors or warnings.

So far I've tried:

  • Updating to the newest version of Cocoapods with: sudo gem update cocoapods

  • Commenting out all the pods in my podfile, running pod update to clear them all out and then uncommenting them and run pod update to re-download and install all the dependancies.

  • Deleting my pod folder and lock file then running pod install to reinstall pods from scratch

Unfortunately none of these steps fixed this error, so I'm guessing there is some Build Setting that I need to tweak in my project but I am unsure what to try next.

5
I'm having the same issue and have spent an eternity trying to find a solution.ZaBlanc
I forgot to read an important line from CocoaPods that says use the xcworkspace file to open the project, not the xcodeproj file. This solved the problem for me.thsorens
@thsorens Nice, glad you fixed it. That's always important otherwise nothing will work so thanks for the reminder (though it was clearly not the problem for me).Nick

5 Answers

41
votes

Double check that you are opening the .xcworkspace file and not the .xcodeproj file, that's a common mistake that can lead to this kind of problems.

29
votes

To fix this I had to delete libPods.a under Application Targets -> General -> Linked Frameworks and Libraries. It was highlighted in red (meaning unfound) but I didn't need to replace it; simply clearing it was enough.

6
votes

For me, the problem was that my project's and Cocoapod's build configurations didn't match, which (I think) meant they were looking in different directories for the compiled libraries.

1
votes

I had the same issue.

My problem was the the 'Build Active Architectures' on my Target and my Pods target did not match up exactly.

After making them identical the issue was resolved.

0
votes
  1. Go to "Project Target -> Build Settings -> Preprocessing -> Preprocessor Macros". Set "COCOAPODS=1" in all Debug, Integration, Release under "Preprocessor Macros"

  2. Add the following in "Other Linker Flags" under "Project Target" $inherited -ObjC -lc++ -all_load

  3. Had a same issue after upgrading Deployment target from 7.0 to 8.0 and enabling use_frameworks!