简体   繁体   English

对旧版本的iPhone禁用iPhone应用程序

[英]Disable iPhone app for older versions of iPhone

我有一个iOS应用程序,并且只希望它在iPhone 6和6 plus上运行,如何在较早版本的iPhone上禁用该应用程序?

You cannot prevent users from downloading it off of the app store. 您不能阻止用户从应用程序商店下载它。 I suggest that you use auto layout to allow your objects to be displayed properly on all display sizes. 我建议您使用自动布局以使您的对象可以在所有显示尺寸上正确显示。

Get iOS device version in AppDelegate and show message there this device not supporting iOS 7 or previous 在AppDelegate中获取iOS设备版本,并在该设备不支持i​​OS 7或更低版​​本的设备上显示消息

Use them like this: 像这样使用它们:

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

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

Outdated version below 下面的版本过旧

to get OS version: 获取操作系统版本:

[[UIDevice currentDevice] systemVersion]

returns string, which can be turned into int/float via 返回字符串,可以通过以下方式将其转换为int / float

-[NSString floatValue]
-[NSString intValue]

like this 像这样

Both values (floatValue, intValue) will be stripped due to its type, 5.0.1 will become 5.0 or 5 (float or int), for comparing precisely, you will have to separate it to array of INTs check accepted answer here: Check iPhone iOS Version 这两个值(的floatValue,的intValue)会由于被剥夺其类型,5.0.1将成为5.0或5(float或INT),用于精确比较,你必须把它分开来的INT勾选接受的答案在这里的数组: 检查iPhone iOS版本

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

and compare like this 并像这样比较

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

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

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