Reputation: 3280
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?
Upvotes: 1
Views: 713
Reputation: 59297
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:
double version = [[[UIDevice currentDevice] systemVersion] doubleValue];
if (version >= 3.0) {
[cell.imageView setImage:image];
} else {
[cell setImage:image];
}
or better yet:
if ([cell respondsToSelector:@selector(imageView)]) {
[cell.imageView setImage:image];
} else {
[cell setImage:image];
}
Note that a compile time check, using ifdef
directives won't work
Dropping 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.
Upvotes: 3
Reputation: 85532
No, you cannot use OS 3.0 calls on a 2.x device. I'd be surprised if you can even install a 3.0-targeted app on a 2.x device.
Upvotes: 1