判斷 iOS 版本

  • Before iOS 8
if(NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)
{
    // > iOS 7.1
}

// or 
UIDevice *device = [UIDevice currentDevice];

if([device.systemVersion compare:@"7.0" options:NSNumericSearch] == NSOrderedAscending)
{
    // >= 7.0
}
  • After
NSOperatingSystemVersion version = {.majorVersion=8,.minorVersion=0,.patchVersion=0};

if([[NSProcessInfo processInfo]isOperatingSystemAtLeastVersion:version])
{
    // >= 8.0.0
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1 Review Start with GRE common word B list, easy and inte...
    玩英语阅读 294评论 0 0
  • 多情总被无情恼 无情却把多情累 白昼黑夜轮回 桐木绿了又红 却是...
    阿火moete阅读 397评论 0 1
  • 小学的时候,小丁是他的同桌。年少的他不懂什么是漂亮什么是美什么是爱。只是单纯的想要和小丁当同桌,一直到生命的尽头。...
    大祭思阅读 293评论 0 1