Xcode cannot run using the selected device?

I am developing my first ever iOS mobile app. I am using OS X Lion 10.7.5 with Xcode 4.6 for development. I completed my app and now want to test on a device. When I am trying to connect iPad Air with iOS 7.1 for testing, Xcode is giving an error:

Xcode cannot run using the selected device. No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination.

I googled and came to decision that I need to use Xcode 5 if I want to test device with iOS 6.1 and above but I cannot install Xcode 5 as it requires OS X 10.8.4 and above. I decided to upgrade my OS from Lion to Mavericks.

Just wanted to know if I do so will it create any problems in my already developed app? I don't have time to take a backup with Time Machine.


Solution 1:

This doesn't seem to be a problem with your version of Xcode/iOS/OS X, but rather that you have not provisioned your device. You need to add your provisioning profile to the device to allow you to test apps on it. Newer versions of Xcode will do this for you, but you can still do it with older versions yourself in the Member Center.

Solution 2:

I had the same problem on Xcode 6.3 after updating a phone to iOS 8.3. Downloading the provisioning files didn't fix the problem, but I stumbled onto a solution:

Connect the phone to your mac and run iTunes. iTunes will ask if you want to trust the phone. Answer yes on the phone and then the Xcode error goes away. I tried it on a second phone, and it worked on it too.