2014-10-19 92 views
1

我有一个iOS应用程序,我只希望它在iPhone 6和6 plus上运行,如何禁用旧版iPhone的应用程序?为旧版iPhone禁用iPhone应用程序

+1

的([禁用用于在Xcode开发的应用程序旧设备的支持]可能重复http://stackoverflow.com/questions/20874979/disabling-old-devices-support-for -developed-app-in-xcode) – almas 2014-10-19 05:06:11

回答

4

您无法阻止用户将其从应用商店下载。我建议你使用自动布局来让你的对象在所有显示尺寸上正确显示。

0

获取的AppDelegate和iOS设备的版本显示的消息有此设备不支持的iOS 7或以前

使用它们像这样:

if (SYSTEM_VERSION_LESS_THAN(@"5.0")) { 
    // code here 
} 

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) { 
    // code here 
} 

过时的版本低于

获取操作系统版本:

[[UIDevice currentDevice] systemVersion] 

返回字符串,可以通过

-[NSString floatValue] 
-[NSString intValue] 

变成INT /浮子这样

两个值(的floatValue,的intValue)将由于被剥离到其类型,将5.0.1成为5.0或5(float或INT),用于精确比较,你将不得不单独给int型数组 检查接受的答案在这里:Check iPhone iOS Version

NSString *ver = [[UIDevice currentDevice] systemVersion]; 
int ver_int = [ver intValue]; 
float ver_float = [ver floatValue]; 

,比较喜欢这个

NSLog(@"System Version is %@",[[UIDevice currentDevice] systemVersion]); 
NSString *ver = [[UIDevice currentDevice] systemVersion]; 
float ver_float = [ver floatValue]; 
if (ver_float < 5.0) return false; 
+2

这不是问题所在。 – rmaddy 2014-10-19 05:03:08

+0

你不能这样做。这是任何机构可以下载的伎俩,只是你想通过检查版本来限制你的功能。它也限制了用户。 – 2014-10-19 05:05:43