简体   繁体   English

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

[英]Unsolvable linker error when compiling app in Xcode

I've been working on an app for some time now and it had been giving me trouble compiling on an iPhone. 我一直在开发应用程序已有一段时间,这给我在iPhone上编译带来了麻烦。 Recently, it stopped compiling even on the simulator. 最近,它甚至在模拟器上也停止编译。 I've browsed stack overflow and other websites for answers but I can't seem to find anything that resolves the issue. 我已经浏览了堆栈溢出和其他网站,找到了答案,但是似乎找不到解决该问题的方法。 Below is the error I'm getting. 以下是我遇到的错误。

I've restored an earlier version of the entire app to see if that fixed the problem but it didn't seem to make any difference. 我已经恢复了整个应用程序的早期版本,以查看是否可以解决问题,但似乎没有什么区别。 I'm still getting the same error. 我仍然遇到相同的错误。

Can anyone help? 有人可以帮忙吗?

    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)

After further review and fiddling, and after reviewing a similar question referenced by @damian, it seems that the solution was this: 经过进一步的审查和摆弄,并在审查了@damian引用的类似问题之后,似乎解决方案是这样的:

I separated the app and the test targets in the Podfile by using 我使用以下命令将应用程序和测试目标分隔在Podfile中

target :App do
…
end

target :AppTests do
…
end

This resulted in two new products libPods-App.a and libPods-AppTests.a, respectively and they made the previous product libPods.a obsolete. 这样就分别产生了两个新产品libPods-App.a和libPods-AppTests.a,它们使以前的产品libPods.a过时了。 I had to remove this product from the Link Binary With Libraries Section of the Build Phases configuration of both targets. 我必须从两个目标的“构建阶段”配置的“与库链接二进制文件”部分删除此产品。

Thanks for the input everyone! 感谢大家的意见和建议!

Try deleting your Derived Data folder, restarting Xcode and and running the project again. 尝试删除您的“派生数据”文件夹,重新启动Xcode,然后再次运行项目。 Go to Window -> Projects and navigate to your project. 转到Window -> Projects ,然后导航到您的项目。 There should be mention of your derived data folder. 应该提到您的派生数据文件夹。 Press Delete , restart Xcode and try building it again. Delete ,重新启动Xcode,然后尝试再次构建它。 See if that kicks it back into high gear again. 看看是否再次将其踢回高速档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM