library not found for -lPods

2019-01-02 22:08发布

I got an error when archiving a project. This is my environment.

  • Mac OS Lion
  • Xcode 4.3.1
  • iOS SDK 5.1

The project deployment target is:

IPHONEOS_DEPLOYMENT_TARGET 3.2

The error shows:

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

I guess Pods is CocoaPods that I used to manage XCode project dependencies. https://github.com/CocoaPods/CocoaPods

This is my Podfile

platform :ios  
dependency 'libPusher', '1.1'

I am not sure what the error means?

30条回答
该账号已被封号
2楼-- · 2019-01-02 22:09

In my case the problem was that Xcode's Derived Data location was set to the "Legacy" option. The CocoaPods target (libPods.a) was being built correctly, but Xcode was looking in the wrong place for it.

Switching it to "Unique" (the default) solved the issue. You can do this by going to Preferences > Locations and clicking the Advanced... button.

查看更多
Bombasti
3楼-- · 2019-01-02 22:09

I tried EVERY answer in this thread to no avail. Finally resolved my issue by matching the "Pre-Configuration Build Products Path" in my target project with the value in the Pods project. Turns out they were building to two different output locations. None of the other suggestions in this thread were relevant for me. Would be great if XCode gave a useful error description (like WHY it can't use the lib - File Not Found, No matching architecture found, etc.).

查看更多
贼婆χ
4楼-- · 2019-01-02 22:09

try open xcworkspace file instead of xcodeproj file

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-01-02 22:10

In my case pod install fixed the problem, after creating distribution and release schemes.

查看更多
forever°为你锁心
6楼-- · 2019-01-02 22:11

I had divided my pod listings in the Podfile for different targets like:

target :ABC do
  pod 'KissXML', '~> 5.0'
  pod 'libPhoneNumber-iOS', '~> 0.7.2'
end

target :ABCTests do
  pod 'OCMock', '~> 2.2.1', :inhibit_warnings => true
end

And ran a pod install

This created a new library libPods-ABC.a to which my binary had to link to. But the bug was that it didn't delete the previous library i.e. libPods.a.

Solution : Remove the library libPods.a from Build Phases of Link Binary With Libraries.

查看更多
The star\"
7楼-- · 2019-01-02 22:11

If you are still getting this issue, try:

pod update

Did the work for me, hope this helps you.

查看更多
登录 后发表回答