我将我的应用设置为使用沙盒,现在我无法运行单元测试。我收到此错误消息:
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 Framework。有任何想法吗?
谢谢!
答案 0 :(得分:12)
如果在项目设置编辑器中创建新的构建配置,则可以进入构建设置选项卡并禁用该配置的代码签名和权利。然后,在方案编辑器中,选择用于单元测试的配置,保持发布和调试版本不变,同时仍然能够运行单元测试。
答案 1 :(得分:0)
我在xcode 5中遇到了同样的问题。在测试目标正确加载之前,我必须在正常目标中禁用沙盒。