TeaCupApp
TeaCupApp

Reputation: 11452

Error loading XCTest, no suitable image found.

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?

Upvotes: 27

Views: 5753

Answers (4)

funct7
funct7

Reputation: 3601

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.

Upvotes: 2

simple_code
simple_code

Reputation: 767

@tagy22's comment worked for me

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

Upvotes: 1

Doug Richardson
Doug Richardson

Reputation: 10821

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.

Upvotes: 0

Kohei Tabata
Kohei Tabata

Reputation: 585

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.

Upvotes: 35

Related Questions