2

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?

Community
  • 1
  • 1
Isaac Paul
  • 1,959
  • 2
  • 15
  • 20
  • An iPhone app uses retina resources on an iPad. Scale would always be 2.0. – duci9y Aug 11 '14 at 13:23
  • 1
    For iPhone-only app is the iPad always Retina screen. Build Universal app and then detect Retina iPads. – Tricertops Aug 11 '14 at 13:38
  • 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 Aug 11 '14 at 13:42
  • @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 Aug 11 '14 at 15:30
  • 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 Aug 11 '14 at 15:36
  • What is the bug that only appears on non-retina devices? – Aaron Brager Aug 13 '14 at 13:46
  • Look here: http://stackoverflow.com/questions/22452638/status-bar-visible-on-ipad-mini-despite-setting-uiviewcontrollerbasedstatusbarap – Isaac Paul Aug 14 '14 at 12:34

1 Answers1

3

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.

Isaac Paul
  • 1,959
  • 2
  • 15
  • 20