1
votes

I have made some apps in 2.2.1 now when I run the same app in 3.1 it gives errors. Changing the codes is a solution I am not looking for. I am looking for some pre-processor directives that can make my app compatible to both SDKs. Something like #ifdef.

Thank You All.

1
What's broken? You might have to change the codes... But you could change the codes in a way that maintains compatibility with 2.2.1. Those darn codes. - Nick Veys
Hi Nick, Can provide me an example? - SocialCircus

1 Answers

3
votes

Similar to How to target a specific iPhone version?

You can use this #define to change what you build for each SDK...

#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2
// iPhone 3.0 code here
#endif
And do this at run-time to run code for 3.0 and above:

float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version >= 3.0){
    // iPhone 3.0 code here
}