How to limit my application to iPhone 6 and 6 Plus only?

CONTEXT

I am developing a crossword puzzle application that currently runs on iPad devices. Recently Apple released devices for the iPhone 6 and iPhone 6+, which, fortunately, have a larger screen and thus become available to run my game (I tested my game on the iPhone 5S and if I found that the user was not comfortable running in this screen size).

Thus, I decided to transfer the application to a universal binary file, which will include support for iPhone 6, iPhone 6 Plus and iPad devices.

Question

  • Is there a way to limit my iOS application to work only on iPhone 6 and iPhone 6+?

Or at least:

  1. Is there a way to limit my iOS application to work only on iPhone 6+ devices?
+7
ios iphone screen xcode size
source share
1 answer

I know that this is possible too late, and probably does not answer this question in any case, but I thought: β€œWhat the hell” is a good code for defining device ranges, where in cases when you may need different functionality.

#import <sys/sysctl.h> -(BOOL)isANewerDevice{ size_t size; sysctlbyname("hw.machine", NULL, &size, NULL, 0); char *machine = malloc(size); sysctlbyname("hw.machine", machine, &size, NULL, 0); NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding]; free(machine); NSString * ending = [platform substringFromIndex:[platform length]-3]; double convertedNumber = [[ending stringByReplacingOccurrencesOfString:@"," withString:@"."] doubleValue]; //Devices listed here: /questions/14934/identify-new-iphone-model-on-xcode-5-5c-5s if ([platform containsString:@"iPhone"]) { if (convertedNumber >= 7.1) { // 6 and above return YES; }else{ return NO; //less than a 6 (ie 5S and below) } }else if ([platform containsString:@"iPad"]){ if (convertedNumber >= 5.3) { //iPad Air 2 and above return YES; }else{ return NO; //iPad Mini 3 and below } } //Failsafe return NO; } 

Link commented in code: Define a new iPhone model on xcode (5, 5c, 5s)

Note Due to the presence of containsString this will crash on iOS versions less than 8. For support <8.0, try using the following code to retro-match this function fooobar.com/questions/80811 / ...

Good luck

0
source share

All Articles