Search code examples
iphoneiosobjective-ciphone-5ios-universal-app

is iPhone 5 always Returns False


I am using the following code (in AppDelegate) to detect if the device is iPhone 5

bool isiPhone5 = CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(640, 1136));

it returns false always. this is not the first time I used that code. eventhe NSLog for that returns {320, 480}

NSLog(@"%@",NSStringFromCGSize([[UIScreen mainScreen] bounds].size));

NOTE: The app was for iPad only and then I made it universal. so I will have 2 storyBoards that is why I need the detection code.

Thanks


Solution

  • Finally I figure it out.

    Solution

    Because the App was for iPad only the Default-568h@2x.png doesn't exist in the project. so after adding it all work properly.

    Note and I dont need the above code because after making the app universal in the xcode project setting there is a part for iPhone/iPod Deployment info configurations (icons,mainStoryBorad,default screens ....) where I can setup the iPhone5 storybord after adding it to the project.