如何解决Xcode链接器警告测试目标在应用程序中

时间:2016-03-02 17:37:30

标签: ios xcode linker-warning

Apple LLVM 6.0 Error: clang failed with exit code -1中提供的解决方案可能会解决此问题,但正如我在问题陈述末尾所说的那样,我不想删除测试目标,除非这是唯一的解决方案。那么,还有另一种解决方案吗?

当试图在Xcode中构建一个新的应用程序时,我收到了大量的链接器警告。警告与自动创建的名为“测试”的目标相关。某些警告的扩展视图如下所示:

Ld /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Products/Debug-iphoneos/My\ AppTests.xctest/My\ AppTests normal arm64
cd "/Users/me/iPhone Apps/myProducts/My App"
. . .
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/Developer/Library/Frameworks'

GenerateDSYMFile /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Products/Debug-iphoneos/My\ AppTests.xctest.dSYM /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Products/Debug-iphoneos/My\ AppTests.xctest/My\ AppTests
cd "/Users/me/iPhone Apps/myProducts/My App"
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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/dsymutil /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Products/Debug-iphoneos/My\ AppTests.xctest/My\ AppTests -o /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Products/Debug-iphoneos/My\ AppTests.xctest.dSYM

while processing /Users/me/Library/Developer/Xcode/DerivedData/My_App-ahfusfuifhsybmalxaykbmfrhylc/Build/Intermediates/My App.build/Debug-iphoneos/My AppTests.build/Objects-normal/arm64/My_AppTests.o:
warning: /Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/3K6537SSXYD4O/UIKit-2LM3EQU7VVY4O.pcm: No such file or directory
...
warning: Could not resolve external type c:objc(cs)XCTestCase
...
warning: Could not resolve external type c:objc(cs)_XCTestCaseInterruptionException

如何消除这些警告?由于我还没有真正理解如何使用测试用例,我宁愿不删除目标(但如果这是唯一的选择,我会)。

1 个答案:

答案 0 :(得分:0)

对于这些消息:

warning: Could not resolve external type c:objc(cs) xXX

当您将Xcode 6项目更新为7时会出现问题。简短的回答是在目标上将调试信息格式更改为" DWARF",仅用于调试配置。

  • 转到“构建设置”并搜索“调试信息格式”
  • 使用dSYM文件"从" DWARF更改调试设置。到" DWARF"
  • 将版本设置保留在" DWARF和dSYM文件"

这是安全的,因为您不需要用于Debug版本的dSYM文件