您的位置:首页 > 其它

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

2015-09-26 00:00 162 查看
摘要: 在使用Xcode的[XCTestCase]做单元测试,开始以为配置都和要测试的target配置一样,但正因此引起不不扫错误,在此记录。

背景:

在使用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]即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Mach-O Type