Checking for function availability in iPhone OS

Since the introduction of the iPad (OS3.2) and iPhone 4 (iOS4), developers have to consider building applications for different versions of the SDK.

We are currently working on an iPhone app that supports version 3.1 to 4.0.1. With the introduction of iOS4 and the iPhone 4 Retina display, we can take advantage of the function UIGraphicsBeginImageContextWithOptions to create higher resolution snap shots.

To check if the function is available at runtime, you can compare it to NULL instead of having to lookup what version of the OS the user is running.

if (UIGraphicsBeginImageContextWithOptions != NULL)
{
    UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
else
{
    UIGraphicsBeginImageContext(size);
}

For more information check out this article http://iphonedevelopertips.com/xcode/base-sdk-and-iphone-os-deployment-target-developing-apps-with-the-4-x-sdk-deploying-to-3-x-devices.html and Apple’s iOS Application Programming Guide has more information on Supporting High-Resolution Screens.



No Responses to “ “Checking for function availability in iPhone OS”

  1. [...] This post was mentioned on Twitter by Simon Barber, Simon. Simon said: Checking for function availability in iPhone OS (Blogged) http://bit.ly/8XfiqD [...]

Leave a Reply

You must be logged in to post a comment.