无法加载测试包,因为出现意外错误 [英] Test bundle could not be loaded because an unanticipated error
问题描述
最近我开始为一个旧的静态库编写测试用例。我已经将库加载到Xcode 5,因为静态库是旧的,我必须手动添加带有测试目标的TestProject。
Recently I have started writing test case for one old static library. I have loaded the library to Xcode 5,Since Static Library is old , I have to manually add TestProject with Test Target.
当我尝试产品 - >测试时,它启动模拟器,控制台显示以下错误
When I am trying "Product-->Test" , It launches emulator and Console shows following error
/xxx/xxx/xxx/StaticLibTest.xctest上的测试包无法加载
,因为发生了意外错误:错误
Domain = NSCocoaErrorDomain Code = 3587bundle StaticLibTest.xctest
无法加载,因为它已损坏或缺少必要的
资源。
(dlopen_preflight(/xxx/xxxx/xxx/Debug-iphonesimulator/StaticLibTest.xctest/StaticLibTests):
找不到合适的图片。找不到:
The test bundle at /xxx/xxx/xxx/StaticLibTest.xctest could not be loaded because an unanticipated error occurred: Error Domain=NSCocoaErrorDomain Code=3587 "The bundle "StaticLibTest.xctest" couldn’t be loaded because it is damaged or missing necessary resources." (dlopen_preflight(/xxx/xxxx/xxx/Debug-iphonesimulator/StaticLibTest.xctest/StaticLibTests): no suitable image found. Did find:
我不知道为什么会出现这个错误。
I don't have any clue why this error comes.
任何有助于指出正确方向的帮助都将非常感激。
Any help for pointing out to the right direction will be really appreciated.
推荐答案
我自己找到了答案。
你的构建设置 - >库和测试项目的架构应该相同
Your Build Settings -> Architectures should be same for Library and Test Project
架构 - >架构= Standrad架构(armv7,armv7s,
arm64)$(ARCHS_STANDARD)
Architectures -> Architectures = Standrad Architectures (armv7 ,armv7s , arm64)$(ARCHS_STANDARD)
你的测试项目的链接 - > Mach-O类型应该是Bundle
Your Test Project's Linking -> Mach-O Type should be Bundle
链接 - > Mach-O Type = Bundle
Linking -> Mach-O Type = Bundle
构建并运行测试。多数民众赞成
Do Build and Run Tests. Thats it
这篇关于无法加载测试包,因为出现意外错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!