当我试图构建一个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中取出它来检查。


当前回答

我的步骤:

删除pods文件夹和“pods”文件。 在终端中输入pod install。 在终端输入“pod update”。

除了确保“构建活动架构”被设置为YES,就像之前的回答中提到的那样,这是为我做的事情。

其他回答

当你从使用Cocoapods的地方克隆项目时,你需要将它们安装到你的项目中。

下面是你需要做的步骤:

1) clone source code to local machine; 2) close the xcode project (if open); 3) install cocoapods application on your mac by running this command in terminal: "gem install cocoapods", add "sudo " in the beginning if did not work; 4) go to the root of your xcode project by using "cd" command in terminal; 5) you should have Podfile in this folder; if you want to double check it use: "cat Podfile" command, it will display the content of this file with Libraries that will have to be installed to your project; 6) then use "pod install" command to download and install the Libraries to your project; the Podfile.lock will be created and {Your project name}.xcworkspace file; 7) from now on you have to use {Your project name}.xcworkspace to open it in xcode;

好运!

以上答案都不能解决我的问题。

我所做的是在目标部分之外运行pod install命令。例如:

#WRONG
pod 'SOMEPOD'

target "My Target" do
    pod 'OTHERPODS'
end

我迅速修复了它,并将错误的pod返回到它所属的目标部分,并再次运行pod安装:

# CORRECT
target "My Target" do
    pod 'SOMEPOD'
    pod 'OTHERPODS'
end

但与此同时发生的是,lib -libPods。a被添加到我的链接库,它已经不存在了,也不应该存在,因为已经有-libPods-My Target。A在里面。

所以解决方案是进入我的目标的通用设置,找到链接框架和库,然后删除-libPods。从名单上选A。

如果项目使用CocoaPods,请注意始终打开.xcworkspace文件而不是.xcodeproj文件。 如果您正在使用。xcworkspace,请重新安装pod文件,删除pod,然后再次插入pod并安装它!!这对我很有效

这个与lPods相关的问题可以通过以下步骤修复

选择您的项目目标。 转到“Link Binary With Libraries”中的“Build Phases”。 现在删除”。一个“生成问题的库的文件”。 清洁和构建。

这是可行的。

这个项目似乎一直在使用椰子足类动物。你项目里的文件不见了。

你不能直接从git中下载。你需要从cocoapods安装它。

如需更多帮助,请参阅CocoaPods入门教程

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