views:

35

answers:

1

Im trying to upgrade my iPhone app from 3.0 to 4.0

Some of the API are deprecated in 4.0, if i use the new API, it might not work on 3.0 right? Therefore i need to have an old API and New API

What is the best way to code for 3.0 and 4.0 for all the pro developers out there?

I know i can check for model and systemVersion from UIDevice.

Do i need to check for which version first and check for which device?

if systemVersion == 3.0 {
//old api code here
}

if systemVersion == 4.0 {

if device == iphone 3G
//new api code here for 3G

if device == iphone 3GS
//new api code here for 3GS

if device == iphone 4
//new api code here for 4
}
+1  A: 

See this article by Matt Gallagher, also if you are an iphone dev check the WWDC videos session, there is at least one session that talk about this.

Benj
thanks for that, its really helpful.
svveet