27

I have recently updated my Xcode and started having this error.

2014-11-03 15:03:54.222 App[13141:60b] Error loading /private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests:  dlopen(/private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests, 262): no suitable image found.  Did find:
    /private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests: code signature invalid for '/private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests'
DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest'

I have done my Google search as usual. But I haven't found any solutions yet. Source I have looked and tried to resolve my issue with is,

  1. http://marcschwieterman.com/blog/testing-in-the-sandbox/

When it happens?

It only shows this error if I run uni test on device. On simulator it works as expected. Running application from normal target does not show this error.

When error shows up while running Uni Test app does not crash. It just fails to load xctests.

Anyone having similar issues? and manage to resolve it?

TeaCupApp
  • 11,316
  • 18
  • 70
  • 150
  • http://stackoverflow.com/questions/19378922/xctest-test-failed – matt Nov 03 '14 at 04:42
  • @matt, It would be better if you can explain. As I have already linked my effort so far...and you have given me the same link again. Except yours is via a Stackoverflow. Also, I am running test on device so code has to be signed as far as I know. – TeaCupApp Nov 03 '14 at 05:00

4 Answers4

35

I've encountered exactly the same problem. I was able to fix the problem by setting the provisioning profile to something other than Automatic on both targets (the test and the test host).

I verified this was the problem by reverting it back to automatic, and the problem reoccured.

Sandy Chapman
  • 11,133
  • 3
  • 58
  • 67
Kohei Tabata
  • 585
  • 4
  • 11
  • Yup that solved the issue...It is definitely a bug in XCode. Thanks Mate! – TeaCupApp Nov 04 '14 at 22:45
  • I tried to set the same provisioning profile for both the app and the xctest bundle but I still got the same invalid signature error. I tried with _iOS Team Provisioning Profile: *_, maybe it works with a provisioning profile with a full bundle identifier… – 0xced Nov 28 '14 at 15:33
  • 2
    Had this error, I had to set both targets provisioning profile to a wildcard profile. – tagy22 Mar 18 '15 at 14:13
2

Xcode 10 here.

For me the issue was the discrepancy between the Project deployment target and the Target deployment target. Once I had them matching, XCTest started working.

funct7
  • 3,407
  • 2
  • 27
  • 33
  • The problem for me was almost the same: the deployment target of the tests target was higher than the iOS version of the simulator that I was trying to use. I hope this helps someone. – cicerocamargo Jul 11 '19 at 10:21
1

@tagy22's comment worked for me

Had this error, I had to set both targets provisioning profile to a wildcard profile.

simple_code
  • 707
  • 9
  • 24
0

I found that if I deleted all iOS developer certificates from OS X keychain and the iPhone developer portal, and then let Xcode re-request the development certificates, the problem is resolved.

Doug Richardson
  • 10,483
  • 6
  • 51
  • 77