When I connect iPhone 6 and check with my code, He think i connect iPhone 5

165 views Asked by At

I have a problem identifying the types of devices.

When I connect iPhone 4 the print is " is iPhone 4"

When I connect iPhone 5 or 5 s the print is " is iPhone 5"

When I connect iPhone 6 plus the print is " is iPhone 6 plus"

And the problem is :

When I connect iPhone 6 the print is " is iPhone 5 "

This is a sample code:

- (void)viewDidLoad {
[super viewDidLoad];

[self print];

}


-(void)print

{
#define isIphone4  ([[UIScreen mainScreen] bounds].size.height == 480)?TRUE:FALSE

if (isIphone4)
{
    NSLog(@"is iphone 4");
}


#define isIphone5  ([[UIScreen mainScreen] bounds].size.height == 568)?TRUE:FALSE

if (isIphone5)
{
    NSLog(@"is iphone 5");
}

#define isIphone6  ([[UIScreen mainScreen] bounds].size.height == 667)?TRUE:FALSE

if (isIphone6)
{
    NSLog(@"is iphone 6");
}

#define isIphone6plus  ([[UIScreen mainScreen] bounds].size.height == 736)?TRUE:FALSE

if (isIphone6plus)
{
    NSLog(@"is iphone 6 plus");
}

}

What could be the problem ??

Edit :

I add a LaunchImage :

enter image description here

And the print still " is iPhone 5 "

1

There are 1 answers

1
Nicolas Manzini On

if you do not include a @3x welcome screen in your app bundle. it will consider the screen size as in an iPhone 5 and will upscale your interface. Maybe that's your issue