6

I'm having trouble running unit testing target on a physical device (iPhone 6 with iOS 8.1 in my case). For this purpose I've created an entirely new iOS Xcode project, opened it and run tests with Cmd + U (Product -> Test). The app compiles successfully and asked me for my code signing credentials. The application even opened up on the device. Everything good up to this part.

But the tests are never run and Xcode is stuck in "Testing" for a few minutes, then finally quits with:

*** Canceling tests due to timeout in Waiting for test process to check in...

The console throws some code signing errors or such:

2014-10-30 08:54:12.585 Test[4721:1298810] Error loading /private/var/mobile/Containers/Data/Application/B727E18E-48BC-4A7E-BDBA-19157ED5A4AC/tmp/TestTests.xctest/TestTests: 

dlopen(/private/var/mobile/Containers/Data/Application/B727E18E-48BC-4A7E-BDBA-19157ED5A4AC/tmp/TestTests.xctest/TestTests, 262): no suitable image found.
Did find: /private/var/mobile/Containers/Data/Application/B727E18E-48BC-4A7E-BDBA-19157ED5A4AC/tmp/TestTests.xctest/TestTests: 

code signature invalid for '/private/var/mobile/Containers/Data/Application/B727E18E-48BC-4A7E-BDBA-19157ED5A4AC/tmp/TestTests.xctest/TestTests'
DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Containers/Data/Application/B727E18E-48BC-4A7E-BDBA-19157ED5A4AC/tmp/TestTests.xctest'

I really do not get it, the app is signed correctly, but I'm guessing that the injected testing library isn't.

Anyone has an idea how to fix this? Or does that mean that we are limited to testing in Simulator?

The project I've been testing this on is available on my GitHub: https://github.com/Legoless/StackOverflow/tree/master/Objective-C/TestTargetFailure

Thanks.

Legoless
  • 10,942
  • 7
  • 48
  • 68
  • Executed 2 tests, with 0 failures (0 unexpected) in 0.356 (0.378) seconds. This is the result I get running it. Try to clean up the project or delete the folder. – gabbler Oct 30 '14 at 08:14
  • This project is created from scratch, so it is clean as it can be. Still getting the problem. :( – Legoless Oct 30 '14 at 09:43
  • I have reproduced this as well. I created a project from scratch (single view) and the default tests will not run on a device but they run fine on the simulator. I don't get the code signature error but this instead: `DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Containers/Data/Application/4CF4CAA8-281B-41D0-8E13-5F0DA7C451C0/tmp/SampleAppTests.xctest'` – Murray Sagal Oct 30 '14 at 16:06
  • I am experiencing the same thing. I submitted a bug report. Please do the same. – David Pettigrew Nov 18 '14 at 17:49

1 Answers1

2

That's a code signing issue.

Solution: go to Build Setting of the test target and make sure the proper (i.e. matching the Bundle ID of your test target) Provisioning Profile and Code Signing Identity is set. You can generate a wildcard provisioning profile for this.

rimantas
  • 47
  • 3