views:

281

answers:

2

If I create an App for the iPhone (OS 3) will it run without modification on an iPod Touch or will I need to create a separate binary? If it is the same runtime, does it just have stubs for the iPhone only features or do you have to check feature by feature using UIDevice to ensure the particular class/method is supported on the device to avoid a crash?

Sorry for the elementary questions, can't find a simple explanation of this anywhere.

Cheers

Dave

EDITED: Based on discussions below:

How can you check if a device supports making calls? At the moment I am assuming if it is an iPod Touch it can't. Is there a way of finding out what shared applications/URL schemes are supported by a device?

+3  A: 

The app will run on an iPod touch, no need to compile a separate version. Features that require an iPhone (e.g. camera) will not work, obviously.

What such features do you intend to use? You may provide alternatives for iPod users or alert them that e.g. no camera is available.

This question adresses how to check if a microphone is present: Detecting iPhone iPod touch accessories

Pascal
That is great thanks. Have created an + (BOOL) isiPhone method add put it in my code for any call number references and it works a treat. Do you know if the shared application URL strings are identical between iPod Touch and iPhone? i.e., sending a string to Google Maps for instance? Dave
Magic Bullet Dave
I haven't worked with that myself, do you mean the URL-scheme? Would be strange if they'd be different. Just consider that the devices run the same OS, just because the hardware differs does not make the OS work fundamentally different. ;)
Pascal
Hi SanHolo, yes I do mean the URL scheme and I agree it would be strange if they were not the same. I guess I mean if they supported different features and therefore differently formatted URLs or if a particular scheme is supported at all. Have added a comment to the post below as I am using the tel: scheme and wondered if it is possible to determine what schemes a device supports.
Magic Bullet Dave
+3  A: 

You shouldn't really try to guess what the device is. You're far more future-proof if you test for the specific functionality you're trying to use. After all, in the future there might be iPods with cameras. Or compasses (which are on some iPhones but not others).

Since it sounds like all you want to do is see if you can open a URL, why not use -[UIApplication canOpenURL:] ? (This would presumably work on iPod touches that had applications that could handle VOIP -- I don't know if any such exist, but I think it's an example of why you need to test for functionality and not make assumptions based on hardware or OS version.)

David Dunham
Agree, this seems the most sensible approach. The main feature I am using is to call a number using the tel: URL scheme. Do you know if it is possible to check if the device supports a particular scheme? Or if not, supports the making of calls, since this is done through the ShareApplication route.CheersDave
Magic Bullet Dave