2
votes

Using xcode 5.1.1 with ios 7.1 to build a iPhone only app.

When running this app on any non-retina device (ipad mini, simulator, ipad 2), [UIScreen mainScreen].scale always returns 2 leaving me with no way to detect if I'm on a retina screen.

This is contrary to all the other posts on checking for retina (Detect Retina Display)

Does anyone have an alternative method besides checking against a list of hard coded devices?

1
An iPhone app uses retina resources on an iPad. Scale would always be 2.0.duci9y
For iPhone-only app is the iPad always Retina screen. Build Universal app and then detect Retina iPads.Tricertops
That sucks because I have a bug that shows up only on non-retina ipads. I suppose the only solution is to manually check the device ids.Isaac Paul
@IsaacPaul, if that is not a universal app, you should not worry about the bug, the iPad runs the iPhone app in a boxed environment, and the app may look different than the app would look on an real iPhone (e.g. statusbar etc...).holex
Bugs are unacceptable lol. They must be fixed. Its all about the user experience and iPad and iPad mini users will not be happy.Isaac Paul

1 Answers

3
votes

It seems the only way is to check the platform identifiers.

I've implemented it here: https://gist.github.com/izackp/2ee0ca4b6c731b254e55

However, it is not accurate on the simulator since I don't get a unique id based on the simulator used, and it will not work for future devices that use retina resources and have a non-retina display.