简体   繁体   English

特定设备支持的最大操作系统

[英]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. 有没有办法使用Objective C查找任何设备支持的最大操作系统。我的用例要求我检查设备操作系统版本和该设备支持的最大操作系统是否相同。 For example an iPad 1 supports only till iOS 5.1. 例如,iPad 1仅支持iOS 5.1。 So how can I get this value ? 那么我如何获得这个价值呢?

There is no standard API for this. 没有为此的标准API。 In fact, you can't determine the answer for many devices. 实际上,您无法确定许多设备的答案。 What would the answer be on an iPhone 5, for example? 例如,iPhone 5的答案是什么? iOS 8? iOS 8? iOS 9? 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. 您能做的最好的事情就是为具有已知最大版本(例如iPad 1上的5.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: 您无法获得iOS支持的最高版本,但可以比较设备版本要求,例如:

-(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;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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