2012-06-14 41 views
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

我使用SenTesting框架与OCMock。有任何想法吗?

谢谢!

+1

原来这是Apples沙箱守护进程中的一个bug。它阻止启用权利时加载测试包。 –

回答

12

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

+0

+1经验证实。应该指出这是正确的答案。 – FluffulousChimp

+1

也就是说,假设您的单元测试不需要权利。例如,您将无法单元测试对组容器的访问权限。 –

0

我在xcode 5中遇到了同样的问题。事实证明,在测试目标正确加载之前,我必须在正常目标中禁用沙箱。

相关问题