I am trying to build a version of my app specifically for iPhone 6 and 6 Plus , whereas I don't have any hardware , I have to test on the simulator ! but it seems , simulator has a strange bug ! first and for most I get screen resolutions and scales , by this code :
UIScreen *mainScreen = [UIScreen mainScreen];
NSLog(@"Screen bounds: %@, Screen resolution: %@, scale: %f, nativeScale: %f",
NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale);
so here is how detect iPhone 6 and 6Plus (Portrait mode):
#define iPhone6 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 667)
#define iPhone6Plus ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 736)
the problem is ! when I lunch my app on iPhone6/Plus simulator , compiler gives me the sceen information of iPhone 4" display :
2014-09-28 12:32:08.153 WOD[2924:42290]
Screen bounds: {{0, 0}, {320, 568}}, Screen resolution: <UIScreen: 0x7fa15be0f9b0; bounds = {{0, 0}, {320, 568}}; mode = <UIScreenMode: 0x7fa15bd0d4a0;
size = 640.000000 x 1136.000000>>, scale: 2.000000, nativeScale: 2.000000
But it works fine on new project ! (I cannot create a new project and start over again !).
I cleaned code
, delete build folder
, change project's name
,and reset Simulator contents setting
but still gives me the information of 4" display ! .
I have checked this Q/A but answers require a real device !