当我试图构建一个iOS应用程序时,我得到这些错误。

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

Ld /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator/Totalbox.app/Totalbox normal x86_64
cd /Users/Markus/Development/xcode/totalbox-ios
export IPHONEOS_DEPLOYMENT_TARGET=7.1
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 x86_64 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator -F/Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator -filelist /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Intermediates/Totalbox.build/Debug-iphonesimulator/Totalbox.build/Objects-normal/x86_64/Totalbox.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -framework CoreGraphics -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Intermediates/Totalbox.build/Debug-iphonesimulator/Totalbox.build/Objects-normal/x86_64/Totalbox_dependency_info.dat -o /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator/Totalbox.app/Totalbox

在构建设置中的PODS ROOT:

${SRCROOT}/Pods

我没有创建这个Xcode项目-只是从git中取出它来检查。


当前回答

在General中检查部署目标,然后转到pod文件中查看

平台:ios, '11.0'

这个11.0在部署目标中应该是相同的

其他回答

经过几个小时的研究,这个解决方案对我来说很有效:

(免责声明:结果可能因情况而异)

库未发现- lpods -(someCocoapod)错误是由于多个条目在:

Settings(Target) > Build Settings > Linking > 'Other Linker Flags'

很多其他的帖子让我去那里看,当我乱动条目时,我会看到错误的变化,但我总是在相同的错误上得到一些变化。

浪费了太多时间……

我的解决办法:

删除'Other Linker Flags'列表中的- lpods -(someCocoaPod)行,但前提是$(inherited)位于顶部。起初我不确定,但令人放心的迹象是,当我离开编辑模式(继承)时,我仍然看到了对我的cocoapods的引用。我在调试和发布中进行了测试,两者都给出了错误,问题立即得到了解决。

在花了半天时间之后,我发现了我的问题。由于一些依赖关系,我将部署目标从10提升到12.1。我更新了项目部署目标和所有的pod。

我刚刚发现在目标级别上也有一个部署目标。升级到12.1后,我的项目再次构建。

“项目”的部署目标

子文件:

“目标”的部署目标:

如果项目使用CocoaPods,请注意始终打开.xcworkspace文件而不是.xcodeproj文件。

我也有这个问题。我的CocoaPods安装出了问题。除KIF外,没有任何吊舱安装正确。我关注了这条线索上的评论,希望能有所帮助。

基本上,我需要确保我的项目和Pods项目的Build Active Architectures Only设置是相等的。

在一个有多个目标的项目中,我在更改方案和应用程序名称并尝试更新pods后遇到了同样的问题。这个问题是由于Build Phases -> Link Binary with Libraries中的多个条目导致的,其中列出了之前的.a库和当前的库,而之前的库已经不存在了。从那里删除库就解决了这个问题。