在Xcode中编译应用程序时无法解决的链接器错误

时间:2016-01-20 08:24:41

标签: ios xcode swift cocoapods

我已经在一个应用程序上工作了一段时间,它一直在给我编译iPhone时遇到麻烦。最近,它甚至在模拟器上停止编译。我已经浏览了堆栈溢出和其他网站的答案,但我似乎无法找到解决问题的任何东西。以下是我得到的错误。

我已经恢复了整个应用程序的早期版本,看看是否能解决这个问题,但似乎没有任何区别。我仍然遇到同样的错误。

有人可以帮忙吗?

    Ld /Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Products/Debug-iphonesimulator/lynx.app/lynx normal x86_64
cd /Users/beauharper/Documents/Developer/lynx
export IPHONEOS_DEPLOYMENT_TARGET=9.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/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/iPhoneSimulator9.2.sdk -L/Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Products/Debug-iphonesimulator -F/Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Products/Debug-iphonesimulator -F/Users/beauharper/Documents/Developer/lynx/Pods/GoogleMaps/Frameworks -filelist /Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Intermediates/lynx.build/Debug-iphonesimulator/lynx.build/Objects-normal/x86_64/lynx.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.2 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lBolts -lFBSDKCoreKit -lFBSDKLoginKit -lParse -lParseFacebookUtilsV4 -lParseTwitterUtils -lParseUI -lc++ -licucore -lsqlite3 -lz -framework AVFoundation -framework Accelerate -framework AudioToolbox -framework CFNetwork -framework CoreBluetooth -framework CoreData -framework CoreGraphics -framework CoreLocation -framework CoreText -framework Foundation -framework GLKit -framework GoogleMaps -framework ImageIO -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -weak_framework Accounts -weak_framework AudioToolbox -weak_framework CoreGraphics -weak_framework CoreLocation -weak_framework Foundation -weak_framework QuartzCore -weak_framework Security -weak_framework Social -weak_framework UIKit -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Intermediates/lynx.build/Debug-iphonesimulator/lynx.build/Objects-normal/x86_64/lynx.swiftmodule -lPods -lPods-lynx -Xlinker -dependency_info -Xlinker /Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Intermediates/lynx.build/Debug-iphonesimulator/lynx.build/Objects-normal/x86_64/lynx_dependency_info.dat -o /Users/beauharper/Library/Developer/Xcode/DerivedData/lynx-gbjyyjvzcpeldyadlzddtokengts/Build/Products/Debug-iphonesimulator/lynx.app/lynx

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

2 个答案:

答案 0 :(得分:2)

经过进一步的审查和摆弄,在审查了@damian引用的类似问题之后,似乎解决方案是这样的:

我使用

将应用程序和Podfile中的测试目标分开
target :App do
…
end

target :AppTests do
…
end

这分别产生了两个新产品libPods-App.a和libPods-AppTests.a,它们使之前的产品libPods.a过时了。我不得不从两个目标的Build Phases配置的Link Binary With Libraries部分中删除此产品。

感谢大家的投入!

答案 1 :(得分:0)

尝试删除Derived Data文件夹,重新启动Xcode并再次运行项目。转到Window -> Projects并导航到您的项目。应该提到您的派生数据文件夹。按Delete,重新启动Xcode并尝试重新构建它。看看是否会再次将其重新拉回到高速档。