I have an app I designed for 3.5 and 4 inch. I adjusted the items on screen with the following method:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
//4 inch code
} else {
//3.5 inch code
}
Then iPhone 6 and 6 plus were released so I had to adjust their screensizes as well. Fortunately the iPhone 6 has the same scale so that worked with the same method. But when it came to the iPhone 6+ it did not work anymore because it is a 3x-scale.
Now this is why I changed my method I used before, to:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if ([UIScreen mainScreen].nativeScale > 2.1) {
//6 plus
} else if (screenBounds.size.height == 568) {
//4 inch / iPhone 6 code
} else {
//3.5 inch code
}
Now that works perfectly on all devices BUT the iPhone 4S. It crashes. The log says:
2014-10-17 21:06:31.370 Lichtpunkt[1288:60b] -[UIScreen nativeScale]: unrecognized selector sent to instance 0x17539920
2014-10-17 21:06:31.372 Lichtpunkt[1288:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIScreen nativeScale]: unrecognized selector sent to instance 0x17539920'
*** First throw call stack:
(0x30b94fd3 0x3b40dccf 0x30b98967 0x30b97253 0x30ae67b8 0x4102b 0x3342fda5 0x3305d2c1 0x33046e3f 0x33121d6d 0x330466f3 0x3304639b 0x3302a03d 0x33029cd5 0x330296df 0x330294ef 0x3302321d 0x30b602a5 0x30b5dc49 0x30b5df8b 0x30ac8f0f 0x30ac8cf3 0x35a21663 0x3341416d 0x18d6b91 0x2c9d1 0x3b91aab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
And the problem is that I can not revert the change to the 1st solution since the iPhone 6+ is then not completely adjusted, I tried.
Can anyone help me please?