支持多个iOS - 应用程序开发



随着iOS6的发布,我将使用iOS6的新功能(例如UICollectionView)更新我的应用程序。

当我在App Store上部署它时,我的应用程序将仅适用于iOS6上的设备。

问:如何让iOS 5.1上的设备使用不使用UICollectionView的旧版本?

我可以更深入地问:在不失去尚未升级操作系统的用户的情况下升级应用程序的策略是什么?

谢谢你的建议。

您可以使用

Class tmp = NSClassFromString(@"UIActivityViewController"); if (tmp) {//use iOS6 class}else{//do something else}检查新iOS6类的可用性。另外,您可以使用一些宏,例如 __IPHONE_5_0 ,在 #ifndef#if defined(...) 之间放置一些代码。祝你好运!

这个将完美运行:

NSString * systemVersion = [[UIDevice currentDevice] systemVersion];
if ([self.systemVersion compare:@"5.0" options:NSNumericSearch] != NSOrderedAscending)
    {
    osHigherThaniOS5 = TRUE;
    }
if ([self.systemVersion compare:@"6.0" options:NSNumericSearch] != NSOrderedAscending)
    {
    osHigherThaniOS6 = TRUE;
    }

只需确定系统版本并相应地设置条件即可:)

相关内容

最新更新