Xcode 5测试未运行

时间:2013-11-13 14:31:50

标签: xcode unit-testing testing xcode5 xctest

当我尝试运行测试时,我从Xcode收到以下消息:

2013-11-13 09:02:57.849 MyProject[378:303] Error loading /Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests:  dlopen(/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests, 262): no suitable image found.  Did find:
/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest/Contents/MacOS/MyProjectTests: open() failed with errno=1
IDEBundleInjection.c: Error loading bundle '/Users/tatami/Library/Developer/Xcode/DerivedData/MyProject-gcralijdlibafgeyfwfeiynnothy/Build/Products/Debug/MyProjectTests.xctest'

此问题已在此处提出:Xcode 5 throws "Library not loaded" error when adding a test target 但该解决方案不适用于我,因为这是一个Mac应用程序。有什么想法吗?

2 个答案:

答案 0 :(得分:3)

您是否在功能下启用了App Sandbox以启用目标?切换它对我有用。

答案 1 :(得分:3)

这是因为沙盒。

同样的问题也发生在OCUnit上(在Xcode 4和5中):XCTest - "Test failed"

这里有关于测试沙盒应用的说明: http://marcschwieterman.com/blog/testing-in-the-sandbox/