Xcode使用[XCTestCase]测试因Mach-O Type引发的错误

背景:

    在使用Xcode7做framework(静态库、动态库)时,对framework做单元测试,开始将测试target相关配置和framework的target配置一直,但测试过程中引起不少错误,再此记录,以免错误再次发生。

错误记录:

    错误①no suitable image found.  Did find:

The bundle “******Tests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.

(dlopen_preflight(/Users/SKY/Library/Developer/Xcode/DerivedData/*****-ekzueajwhgbiqddhbeagtdzjcsgo/Build/Products/Debug-iphonesimulator/EMPKitTests.xctest/*****Tests): no suitable image found.  Did find:
	/Users/SKY/Library/Developer/Xcode/DerivedData/EMPKit-ekzueajwhgbiqddhbeagtdzjcsgo/Build/Products/Debug-iphonesimulator/*****Tests.xctest/*****Tests: unknown file type, first eight bytes: 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A)
Program ended with exit code: 82



    错误②: can't open file: ***** (No such file or directory)

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/lib/libz.1.2.5.tbd (No such file or directory)

错误原因

    target[test]的Mach-O Type类型设置错误,{target[test]---->Build Settings----> Mach-O Type}将其设置为默认设置[ Bundle]即可。

你可能感兴趣的:(type,Mach-O)