简体   繁体   中英

Max supported OS for a specific Device

Is there a way to find the maximum supported OS by any device using Objective C. My Use Case requires me to check if the Device OS version and Maximum OS supported by that device are the same. For example an iPad 1 supports only till iOS 5.1. So how can I get this value ?

There is no standard API for this. In fact, you can't determine the answer for many devices. What would the answer be on an iPhone 5, for example? iOS 8? iOS 9?

The best you could do is hardcode a table of values for devices with a known maximum version such as 5.1 on the iPad 1.

You'll have to hard-code that information. It's impossible for the OS to tell you what the maximum supported version is, because that information generally isn't known until a version is released which doesn't support the device.

You cannot get maximum version supported in iOS but you can compare device version requirement like:

-(BOOL)doesSystemVersionMeetRequirements:(NSString *)minReq // minReq : required version to work
{  
  NSString *thisSysVer = [[UIDevice currentDevice] systemVersion]; // current version

  if([thisSysVer compare:minReq options:NSNumericSearch] != NSOrderedAscending)
  {
    return YES;
  } 
  else
  {
    return NO;
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM