Page 1 of 1

iPhone Programming

Posted: Mon 29 Jun, 2009 6:33 am
by PISD Support
I'm going to put useful iPhone programming information into this thread as time progresses and we wrestle with the iPhone API. Anyone can contribute to the thread though so feel free to join in.

Retrieving debug output files from an iPhone
Data under your applications writable areas is accessible via. the 'Organiser' on Xcode (highlight the device and then open the application being debugged in the bottom panel - then hit the 'arrow' button to download the information onto your Mac). This is invaluable as it allows you get information off the device when running outside of the debugger (for instance outputting information to a debug text file).

Thumb executable builds
By default Xcode will build 'Thumb executables' for the iPhone. Be warned if programming applications requiring speed these can be much slower than a non-thumb build.

Organizer says "Could not support development.
This error appears very occasionally when you attempt to use your hardware for debugging (appears in the Xcode Organiser instead of the normal list of provisioning profiles and applications).

This most commonly occurs after updating a device with a new provisioning file and can be 'cleared' by rebooting the device in question.

Failure to run app outside of Xcode debug
You may find that your application runs fine through the debugger in Xcode but fails to launch when you attempt to run it natively on the hardware (ie. by clicking on the icon on the iPhone). This is normally attributable to the startup for the program taking longer than the OS allows; in which case the operating system helpfully kills the program without giving any visible notifacation of why this has happened.

You can confirm this by making the program spool debug to the output stream and following its output in the Xcode 'Organiser' Console window.

Re: iPhone Programming

Posted: Tue 14 Jul, 2009 1:00 am
by PISD Support
Another 'fun' one for people - after updating to the 3.0 OS development SDK I found a couple of things had changed in my existing projects:

The linking rules for sub-projects which were building library files had been removed.
This is fairly easy and obvious to spot as you'll get lots of symbol errors from the calls to that library.

The comipler version the project was using had changed to 4.2.
4.2 is incredibly pedantic about compilations and you'll probably find you've 100's of new and (cough) interesting warnings to spend time fixing.

Finally it is entirely possible that you'll get an error about corrupt object files when you try to launch the program. This is identical to the 'standard' error which sometimes comes and goes during builds - but instead will consistently prevent launching. This appears to be due to mis-matching of 4.0 (or whatever your prior compilation version was) and 4.2 object files, doing a clean all, clearing the Xcode cache and rebooting your Mac will normally clear this problem.

(incidentally Apple indicate the 4.2 compiler is OPTIONAL for the 3.0 OS so you can try dropping back to 4.0 if you want to, however I haven't personally got 3.0 compiling under that version of gcc)

Re: iPhone Programming

Posted: Sun 19 Jul, 2009 4:28 pm
by PISD Support
Device could not support development
Sometimes you will mysteriously find your iPhone will not respond correctly when you try and run something on it through Xcode; at this point the error shown above will be visible within the 'Organiser'.

To fix this simply hard reset your device (ie. just down turn it on/off, power cycle it and do a full restart with the apple logo startup).