5

我将我的应用程序设置为使用沙盒,现在我无法运行我的单元测试。我收到此错误消息:

objc[18812]: GC: forcing GC OFF because OBJC_DISABLE_GC is set 2012-06-14 09:19:42.689 Gitpilot[18812:603] Error loading /Users/corey/Library/Developer/Xcode/DerivedData/Gitpilot-bedgmtkbdheptpbpjfklegmqyipi/Build/Products/Debug/GitpilotTests.octest/Contents/MacOS/GitpilotTests: dlopen(/Users/corey/Library/Developer/Xcode/DerivedData/Gitpilot-bedgmtkbdheptpbpjfklegmqyipi/Build/Products/Debug/GitpilotTests.octest/Contents/MacOS/GitpilotTests, 262): no suitable image found. Did find: /Users/corey/Library/Developer/Xcode/DerivedData/Gitpilot-bedgmtkbdheptpbpjfklegmqyipi/Build/Products/Debug/GitpilotTests.octest/Contents/MacOS/GitpilotTests: open() failed with errno=1 IDEBundleInjection.c: Error loading bundle '/Users/corey/Library/Developer/Xcode/DerivedData/Gitpilot-bedgmtkbdheptpbpjfklegmqyipi/Build/Products/Debug/GitpilotTests.octest' 2012-06-14 09:19:42.733 Gitpilot[18812:603] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/rs/63y00fxj7dj07g91vrswhk240000gn/T/com.gitpilot.Gitpilot/com.gitpilot.Gitpilot.savedState

我正在使用带有 OCMock 的 SenTesting 框架。有任何想法吗?

谢谢!

4

2 回答 2

12

如果您在项目设置编辑器中创建新的构建配置,您可以进入构建设置选项卡并禁用该配置的代码签名和权利。然后,在方案编辑器中,选择该配置进行单元测试,让您的发布和调试版本保持不变,同时仍然能够运行单元测试。

于 2012-09-11T20:59:01.483 回答
0

我在 xcode 5 中遇到了同样的问题。原来我必须在正常目标中禁用沙箱才能正确加载测试目标。

于 2014-01-28T12:00:00.127 回答