How to Resolve Xcode Linker Warnings For Tests Target in App

假装没事ソ 提交于 2019-12-12 03:32:34

问题


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?

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'

and

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).


回答1:


For these messages:

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

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.

  • Go to Build Settings and search for Debug Information Format
  • Change the Debug setting from "DWARF with dSYM File" to "DWARF"
  • Leave the Release setting at "DWARF with dSYM File"

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



来源:https://stackoverflow.com/questions/35754326/how-to-resolve-xcode-linker-warnings-for-tests-target-in-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!