If I set the Base + Active SDK of an iPhone app to 3.0 and the Deployment Target to 2.2, can I use the new versions of functions on 2.2 devices?
For example, UITableViewCell now requires an image to be set using [cell.imageView setImage:image], whereas in 2.2, you’d call [cell setImage:image]. Will using the new [cell.imageView setImage:image] crash on 2.2 devices?
Nope you cannot us OS 3.0 calls on 2.2. Deprecated method should be behave as normal at least in OS 3. Deprecation in many cases in the OS, just means that Apple recommend using new methods rather then deprecated ones; but those methods may disappear in the future too.
You have few options:
Have a runtime check to determine the OS version, and invoke the appropriate method:
or better yet:
Note that a compile time check, using
ifdefdirectives won’t workDropping OS 2.2 support. It’s quite reasonable for you to only target 3.0 as well, as the uptake of 3.X is quite high. In the case of my small app, in December I had 27 users on pre-3.0 systems out of 2,058 users. Needless to say, this option reduces your testing need significantly.