Reputation: 3807
I have an iOS app, and I only want it to run on iPhone 6 and 6 plus, how do I disable the app for older versions of iPhone?
Upvotes: 1
Views: 259
Reputation: 2530
Get iOS device version in AppDelegate and show message there this device not supporting iOS 7 or previous
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
}
to get OS version:
[[UIDevice currentDevice] systemVersion]
returns string, which can be turned into int/float via
-[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
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;
Upvotes: 0
Reputation: 296
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.
Upvotes: 4