CIFilter
CIFilter

Reputation: 8677

iPhone Device Debugging

Is it possible to actually use the Xcode debugger when running an iPhone app on the device rather than the simulator? i.e., can I have the device stop at breakpoints that I set in my code and step through the code as it runs on the device?

EDIT: I should mention that I am a registered developer with Apple and have a valid certificate. In fact, I can build and run iPhone applications on my device just fine. However, even in Debug mode, my application will not stop on breakpoints or output to the console when I run it on my device. If it helps, my application will function normally in debug mode (e.g., stopping at breakpoints) when I run in the simulator.

EDIT 2: I've tried resetting my phone, completely removing and reinstalling Xcode, creating a new project, changing all the settings mentioned in the answers on this page (as well as others), cleaning and building my project, Build and Debug... If I click Pause, it says "Error from Debugger: Quit". :( Maybe I'll try to debug on this device using Xcode on another computer and see what happens.

EDIT 3: Well, I tried using another computer using a fresh install of Xcode in a new project, and I still can't get device debugging to work. I have a suspicion that it's my iPhone or cable perhaps? I'd like to think that I'm not so incompetent that I've missed something so embarrassingly obvious, but I've double- and triple-checked all of the suggestions mentioned here.

EDIT 4: FINALLY got device debugging to work. I have a feeling that something low-level on my device was causing issues...nothing I did worked on my system. However, I installed Xcode on another system and device debugging on the same device (with the same cable) worked flawlessly. Directly after that, device debugging began working on my original machine, leading me to believe that some strange hardware flag was screwed up and somehow "reset" on the second machine. In any case, it works now... Thanks for all the help. :)

Also, I'm unsure if it's better to leave this question unanswered or pick the most "helpful" answer...

Upvotes: 15

Views: 55285

Answers (7)

MikZ
MikZ

Reputation: 364

You may try last trick in case nothing can help.

If your application launched successful on your device from XCode but did not stop at breakpoints - try press "pause" button after start in debug mode. If you will see application paused properly (do not react to user's action) add new breakpoint then press "run" to continue application execution. In some cases it may helps to stop at new breakpoint.

Upvotes: 2

MrDatabase
MrDatabase

Reputation: 44455

Make sure to start debugging by pressing "Cmd-Y"... and not "Cmd-R" :-)

Upvotes: 4

Ransom Weaver
Ransom Weaver

Reputation:

Xcode>preferences>debugging uncheck load symbols lazily

fixed the breakpoints not holding in device problem for me.

Upvotes: 0

MikZ
MikZ

Reputation: 364

If you need to setup debugging for jailbroken iPhone (up to 2.2.1) (not pay 99 to Apple yet) follow next steps:

  • Install MobileInstallationPatch for your iPhone via Cydia (use Search Tab)

  • Switch off PROVISIONING_PROFILE at XCode: Go to /Developer/Platforms/iPhoneOS.platform/Info.plist, add next keys:

<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>

You may also add these keys to any project particularly at XCode, Project Build Settings, User-Defined variables.

Important! You may need to install and launch at least one legal app (any free one) from App Store first (before "Build and Go" step). Otherwise your application will be successfully installed by XCode to your device but may not be launched. Try this troubleshoot first in case of problem with app launching.

Upvotes: 1

Nosredna
Nosredna

Reputation: 86276

Yes. Debugger and performance tools work fine on the device. That's where I do most of my debugging.

Upvotes: 0

Andrew Garrison
Andrew Garrison

Reputation: 7017

Yes, just set your project to build for the Device.

Upvotes: 1

Lou Franco
Lou Franco

Reputation: 89222

Yes -- just use a device build. You have to get certificates and provision it.

This is a good description:

http://boga.wordpress.com/2008/07/16/debugging-ipod-provision-profilescertificates/

Upvotes: 10

Related Questions