Friday, January 30, 2009

How to debug handleOpenURL

I've seen a number of questions on the Apple iPhone developer forums asking how to debug the UIApplication handleOpenURL message. I finally had a complex scenario that I needed to debug, and came up with the following solution. Note that this example has been tested using the simulator only. Firstly, you'll need to grab the two 'DebugSupport' files from my google code repository here. Include them in your project and modify your handleOpenURL message as follows:
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
 [DebugSupport waitForDebugger];
 // place breakpoint after the above line
The call to [DebugSupport waitForDebugger] shows a UIAlertView, which will wait until you confirm by clicking the OK button. You'll notice that the prompt tells you the process ID. Don't click OK yet. Return to XCode and from the Run menu, choose Attach To Process | Process ID... Enter the PID given to you from the alert box and XCode will attach and enable all the breakpoints. Obviously, remove this from production code. Enjoy.

iPhone 3.0 Wish List

I took this from a comment I made on TUAW

Here's what I'd like to see, assuming we'll also get iPhone 3.0 software update.

  • The entire screen should be touch enabled, so the border could be used for interactivity.
  • ARM Cortex A9 (multi-core version would be a dream),
  • PowerVR SGX and
  • minimum of 256MB RAM (up from 128MB)

Software, given the above specs
  • Background applications
    • I'm wondering if this is coming rather than Apple's original 'push' solution, since we haven't seen it yet...

  • Support for cross-application communication / shared data
    • At the very minimum, this should be permitted for apps released by the same developer

  • Major innovations to Springboard, since it is becoming unwieldy on iPhones with many apps installed
    • 'spotlight' style launching would be good
    • It could be arranged in a grid pattern so you could flip left, right, up or down or diagonally. A faint arrow could show you where centre is. Pressing home would take you back to the centre screen.
    • For up to 9 screens you would be no more than 2 flips from any other screen.
    • A gesture (like pinch) could be used to zoom out the spring board, like spaces to see 4 page or further out for 6 and then 9 pages. Tap on a page to zoom back.
    • You should be able to name spaces, so you could see text on each space. e.g. 'Games', 'Financial', etc...

Sunday, January 04, 2009

Utility class for loading a UIImage without caching

I've checked in a utility class for UIImage, which adds a new category to load images without caching .  You use it as follows:

UIImage *image = [UIImage imageFromResource:@"my_image.png"];

You should only do this if there is a specific reason you do not want caching.