开发者

If you make your iPhone app universal, can you undo it in a future version?

I've made a universal iPhone/iPad app (transitioned from iPhone only), but in a future version, I'm going to switch heavily to iOS 4-only features.

For the ne开发者_运维问答xt update of my app, can I update only the iPhone version?


Since iPad runs iOS3.2, your code has to handle both.

if ([[UIDevice currentDevice].systemVersion isEqualToString:@"4.0"]) {
  [self doOs4Stuff];
} else {
  [self doOs3Stuff];
}

Though you have to be careful about using 4.0 specific APIs, loading the classes with tricks like NSClassFromString() in order to prevent it from crashing on older OS versions.

My example could using more robust version checking too, may parsing the string to test if the major version is "4" or "3", for instance.


You would have to update both applications, as they are bundled into one single binary. However, using conditional coding (e.g. if !(UIUserInterfaceIdiom() == UIUserInterfaceIdiomPad) { - note that I always check for an iPhone/iPod Touch this way as on OS 3.1.3 or lower, it will return nothing), you can make it so that only the iPad version is different.

As for reversing making it Universal - go into your project and target settings, and change the 'Targeted Device Entry' to either iPhone or iPad. The option to upgrade your target should appear again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜