如何为应用程序中的测试目标解决Xcode链接器警告 [英] How to Resolve Xcode Linker Warnings For Tests Target in App

查看:121
本文介绍了如何为应用程序中的测试目标解决Xcode链接器警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple LLVM 6.0中提供的解决方案错误:失败而退出代码为-1 的clang可能可以解决此问题,但是正如我在问题声明结尾所指出的那样,除非这是唯一的解决方案,否则我不希望删除Tests目标.那么,还有其他解决方案吗?

The solution offered in Apple LLVM 6.0 Error: clang failed with exit code -1 may work to resolve this problem, but as I stated at the end of my problem statement is that I did not want to remove the Tests target unless that is the only solution. So, is there another solution?

当尝试在Xcode中构建新应用时,我收到大量链接器警告.这些警告与自动创建的称为测试"的目标有关.某些警告的展开视图如下所示:

When trying to build a new app in Xcode, I am getting a ton of linker warnings. The warnings are related to a target that was automatically created called Tests. The expanded view of some of the warnings look like the following:

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

我该怎么做才能消除这些警告?既然我还不太了解如何使用测试用例,我宁愿不删除目标(但如果是唯一的选择,我会的).

What can I do to eliminate these warnings? Since I don't really understand how to use test cases yet, I'd rather not delete the target (but if that is the only option, I will).

推荐答案

对于这些消息:

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

当您将Xcode 6项目更新为7时,就会发生问题.简而言之,就是将目标上的调试信息格式更改为"DWARF",仅适用于调试配置.

The problem happens when you have a Xcode 6 project updated to 7. The short answer is to change the Debug Information Format to "DWARF", on the target, for the Debug configuration only.

  • 转到构建设置"并搜索调试信息格式"
  • 将调试设置"从带有dSYM文件的DWARF"更改为"DWARF"
  • 在带有dSYM文件的DWARF"中保留发布"设置

这很安全,因为您不需要dSYM文件即可进行调试版本

This is safe because you don't need dSYM files for Debug builds

这篇关于如何为应用程序中的测试目标解决Xcode链接器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆