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


当前回答

当你从使用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;

好运!

其他回答

当你从使用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;

好运!

如果有人在使用Cocoapods安装react-native-fbsdk后来这里解决错误,请记住,你必须在项目构建阶段删除所有其他的.a文件,只保留Cocoapods中名为libPods-WhateverAppName.a的.a文件。

这通常是由运行rnpm link和rnpm的工作方式引起的。

在我从构建阶段删除facebook core .a文件后,我的项目再次启动并运行。

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

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

“项目”的部署目标

子文件:

“目标”的部署目标:

对我来说,遵循是有效的。

进入“项目目标->构建设置->预处理->预处理器宏”。在“预处理宏”下的所有调试,集成,发布中设置“COCOAPODS=1” 在“项目目标”下的“其他链接器标志”中添加以下内容 继承了美元 objc lc + + -all_load

清理并运行项目。如果仍然收到相同的错误,然后尝试设置“项目目标->构建设置->仅构建活动架构”,将“调试”设置为“YES”,将“集成和发布”设置为“No”。然后对所有“Pods Targets”重复同样的“Build Active Architectures Only”设置

清理并运行项目。如果您收到以下错误

 No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

然后试试迈克先生在这个链接中的回答

Xcode 5.1 -没有架构需要编译(ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

希望能有所帮助!

如果你的项目中有多个目标,Cocoapods可能只与其中一个目标很好地集成。

我必须手动链接到libPods。在“Link Binary With Libraries”中为我拥有的每一个额外目标添加一个。