7
votes

I can't for the life of me find out how to run applicaitons on a device (specifically, and iPhone 4) using XCode 4.

The documentation says to "Set the run destination to iOS device in the scheme editor and build and run your application."

The dropdown menu in the schema editor only has simulator options.

Could someone present a step-by-step method for running applications on devices using Xcode 4?

Using: Xcode 4.0.2 (iOS 4.3) iPhone 4.3.3

UPDATE

I ended up doing a series of restarts (Macbook Pro, iPhone 4, Xcode), did a few cleans and builds of the project, and set the "Base SDK" build attribute for the TARGET to "Latest iOS (iOS 4.3).

After that, the device appeared in the destination drop-down in the scheme editing menu.

(Thank you for your time septi!)

5
I have a developer license and have created a provisioning profile (includes app id, developer certificate, and device). The Xcode 4 organizer has a green light next to my device. I have also read the doc: developer.apple.com/library/mac/#documentation/ToolsLanguages/… but it does not go into detail in the section "Run Your Application On the Device."user487890
Hummmm... That should then work fine ;-) Did you click on "use this device for development"? I remember that there is some button to enable the device...tamasgal
I'm sure I accepted it if it showed up. Despite having downloaded the latest version of Xcode, iOS 4.3 is not included in the "iOS Deployment Target" build setting...any ideas why this may be? My phone has 4.3.3 installed, and if the deployment target isn't set to 4.3, Xcode may not recognize the device.user487890
Ouh, I didn't update my device yet, neither Xcode, but I think if you get the latest SDK from ADC it should work...tamasgal
By "work," do you mean that the device should display in the "Destination" drop-down menu in the scheme editor? After you set up the provisioning profile setup in xcode 4, what steps did you take to get it "to work."user487890

5 Answers

20
votes

Be sure to Verify the BASE SDK used in your project. From the docs:

" Note: If you are building to your development device, the Base SDK version number defined on your Xcode project must be greater than or equal to the software version number on your development device; otherwise Xcode cannot initiate a debugging session with the device. In that case, you will need to download and install the latest iOS SDK version that is greater than or equal to your device software version. "

3
votes

I had a similar problem. My phone has iOS 4.2.1

I downloaded a sample app and my phone did not show up as an option, only the simulators were listed.

So this is just a configuration issue:

To fix this you need to select the project, and:

  1. (as noted above) Select Build Settings/Base SDK = (in my case) Latest iOS (iOS 4.3)
  2. Select Summary: Devices: iPhone
  3. Select Deployment Target: (in my case) 4.2

Now I get the following in the dropdown list of targets:

Myiphone (4.2.1, overriding Base SDK to 4.3)

1
votes

Also watch out for the UIRequiredDeviceCapabilities property in the plist file. This can prevent a device from showing up sometimes.

0
votes

I encountered this today in XCode 5 and tried the steps specified. Eventually, I found another solution that may be of use to future readers (Xcode 4 or otherwise).

  1. Go to your project settings and select your target.
  2. Select the "General" tab and scroll to Deployment Info.
  3. Under "Deployment Target", make sure that your device's OS, or something lower, is specified.
  4. ---> Your device should now show up as available for debugging in the listing.

Came across this by checking the same device in another project. In that project, the device was listed just fine. When looking at the project settings between the two, the above difference was what stuck out and resolved the issue.

0
votes

The "Deployment Target" in the project general settings needs to be <= your device, as Danny said above.

Be aware that when you create a new project in a new version of XCode, the default deployment target will be the latest OS release. If your iPhone is on a lower release, this means you either need to upgrade your iPhone, or install an older SDK into your XCode.

You can install an older SDK by copying it into the XCode package at location:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs