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


当前回答

对我来说,这是可行的。我已经将我的应用程序名称从someApp更改为otherApp。我正在使用可可豆荚进行多个第三方服务集成。因此,由于添加了2 libPod文件(因为我已经更改了应用程序的名称和目标)。最后我不得不删除一个libPod。这招奏效了。

目标->构建阶段->链接二进制库

其他回答

对我来说,这是可行的。我已经将我的应用程序名称从someApp更改为otherApp。我正在使用可可豆荚进行多个第三方服务集成。因此,由于添加了2 libPod文件(因为我已经更改了应用程序的名称和目标)。最后我不得不删除一个libPod。这招奏效了。

目标->构建阶段->链接二进制库

这是我在尝试使用cocoapods将Firebase集成到Xcode项目时遇到的问题

library not found for -lGoogleToolboxForMac
linker command failed with exit code 1 (use -v to see invocation)

经过数小时的搜索和尝试在stackoverflow中列出的各种修复程序后,我的问题终于按以下步骤修复了

转到构建设置,搜索其他链接器标志,删除所有值,除了$(继承)

对所有目标都这样做。

删除pods文件夹。(ios /豆荚) 进行pod更新

瞧!所有链接错误都将消失。

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

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

我得到了同样的错误。

问题:我创建了一个单独的工作区,并将我现有的项目添加到其中。当我在那个工作区工作时,我得到了错误。

解决方案:后来我发现,当添加依赖项时,Workspace会自动在现有项目中创建。并且必须在那个工作空间里工作。