Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 running tests on physical iOS device does not work

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.

like image 855
Legoless Avatar asked Oct 30 '14 08:10

Legoless


People also ask

How do I test iOS apps locally?

Open up a project in Xcode and click on the device near the Run ▶ button at the top left of your Xcode screen. Plug your iPhone into your computer. You can select your device from the top of the list. Unlock your device and (⌘R) run the application.


1 Answers

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.

like image 148
rimantas Avatar answered Nov 15 '22 00:11

rimantas