I am trying to run unit tests on Xcode 6 if I run them on the simulator (and 7.1 at that) they run fine
other conditions yield this message:
2014-10-10 01:39:56.190 MyApp[493:173988] Error loading
/private/var/mobile/Containers/Data/Application/A6C42E86-0147-4447-A605-
FF864C5BD0F7/tmp/MyAppTests.xctest/MyAppTests:
dlopen(/private/var/mobile/Containers/Data/Application/A6C42E86-0147-4447-A605-
FF864C5BD0F7/tmp/MyAppTests.xctest/MyAppTests, 262): no suitable image found.
Did find:
/private/var/mobile/Containers/Data/Application/A6C42E86-0147-4447-A605-
FF864C5BD0F7/tmp/MyAppTests.xctest/MyAppTests: mmap() error 1 at address=0x006D0000,
size=0x0001E000 segment=__TEXT in Segment::map() mapping
/private/var/mobile/Containers/Data/Application/A6C42E86-0147-4447-A605-
FF864C5BD0F7/tmp/MyAppTests.xctest/MyAppTests
how do i fix it ?
You have to first make sure your debug symbols in the test target are setup like this:
Then make sure you don't have any classes in the compile sources of your test target build phase that are not tests and that you have your app's target as a target dependency in the build phases of the test target
Then in the general tab of your test target make sure the test application is set, and there is a checkmark in allow testing host application API
last but not least, you have to make sure that the device you are running your test on, is not running iOS 8.0 (yes eight dot zero), either 7.1.2 are good or 8.1 - if your xcode does not support 8.1 you have to download this support - it's already available through the download section in the xcode preferences.
I followed the steps of Lena Bru, but it didn't fixed my problem. Then I found this question about code-signing issues. I checked the general tab in my project settings and found out that "Team" was set to "None". After selecting a team, my tests run without problems.