Cocoapods Completely Broke

2019-06-23 22:32发布

问题:

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?

回答1:

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".