Xcode 5 Tests Not Running

2019-05-29 04:15发布

I get the following message from Xcode when I try to run my tests:

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'

This question has already been asked here: Xcode 5 throws "Library not loaded" error when adding a test target but the solution doesn't apply to me as this is a Mac app. Any ideas?

2条回答
beautiful°
2楼-- · 2019-05-29 05:16

This is because of sandboxing.

Same issue also happens with OCUnit (in both Xcode 4 and 5): XCTest - "Test failed"

There's instructions for testing a sandboxed app here: http://marcschwieterman.com/blog/testing-in-the-sandbox/

查看更多
叼着烟拽天下
3楼-- · 2019-05-29 05:18

Do you have App Sandbox under Capabilities for your target enabled? Switching that off worked for me.

查看更多
登录 后发表回答