Recently I developed a simple application that is retrieving data from a URL using NSURLSession, parses JSON and displays a list of popular movies in the CollectionView. As far as, with the release of iOS 9 and Xcode 7, Apple made testing on devices available without the need to be registered in the Apple Developer Program, I decided to run my application on my iPhone 6S.
During the setup I encountered several problems. So considering that you might as well face these problems, here’s step-by-step guide on How to run your iOS project/application on your physical device using Xcode 7.
This is how:
Connect your device with lightning cable directly to your mac. On Stackoverflow one user reported that he had crashes when using USB Hub. This was not a case with me, but it’s worthy to note.
As soon as you connect your device, in the project navigator, choose your device from the Scheme toolbar menu.
NOTE: If your device is disabled in the Scheme toolbar menu because it is ineligible, fix the issue before continuing. Under Ineligible Devices, hover the mouse over the device to read the reason why it’s ineligible. For example, if the device doesn’t match the deployment target, upgrade the OS version on the device or choose the version you want to target from the Deployment Target pop-up menu (located in the Deployment Info section). Then select the device from the Scheme toolbar menu.
On the image above, you see loading icon next to selected device name. This is Xcode processing symbol files and you can’t continue till it finishes loading them. In case you Run your project Xcode will continue when it’s finished. Meanwhile, what it does is, it downloads the (debug) symbols from the device, so you can debug your application on the selected device with the specific iOS version that is installed. It also needs it for crash reports that might happen on your device.
Next, when the processing of symbol files is finished and you Run your project, if the signing identity is set to None, Xcode launches your app. Otherwise, Xcode registers your Mac and adds it to the team provisioning profile before launching your app. Xcode might prompt you with “Failed to code sign your application”:
In order to resolve it, click Fix Issue and enter your Apple Id credentials. After you enter your Apple Id, in the Accounts window your information will be displayed and from the above pop-up select your account and click Choose.
You might think that that’s it. But next you will encounter “Couldn’t launch your application, process launch failed: Security”.
This is because apps from a non-verified developers (in this case it’s your account) are not trusted on your device and will not run until the developer isn’t is trusted.
In order to make yourself a trusted developer on your device, you should go to:
- iOS prior version 9.2: Settings -> General -> Profile, locate your developer profile and select to trust it;
- iOS version 9.2: Settings -> General -> Device Management, locate your developer profile and select to trust it;
That’s it! Hope you did solve your issues and now you are getting pleasure from launching your application on your iPhone or iPad. Happy iOS app development!