判斷 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
}

你可能感兴趣的:(判斷 iOS 版本)