0

Problem:

If I deselect iPad as a device that I want to deploy to, as shown below: enter image description here

and then run my app using debug/TestFlight on my iPad, UIDevice.current.userInterfaceIdiom (from here) returns phone instead of pad.

Question:

How can I detect that the app is running on an iPad in this state?

Context

The problem is that this Stair Climber app, that you can test here requires HealthKit to work, and iPads don't have the Health app, so I can't pull in Flights Climbed data into the app, so the app is basically useless. And even though I deselect iPad and don't add iPad pictures to the listing, the App Store review team rejected me for the UX on iPads -,-. That is why I want the user to have a different experience if they are not using iPhones.

Asperi
  • 228,894
  • 20
  • 464
  • 690
Saamer
  • 4,687
  • 1
  • 13
  • 55
  • Have you tried including the iPad? Since you already want to deal with the difference, you should include the iPad. A word of warning, though. The reviewers use iPads (which is why you were rejected) so you need to be acutely aware of the functionality on iPads. – Yrb Jun 22 '22 at 01:37
  • Yes of course when I include the iPad, it does show up as `pad`, but I don't want to include the iPad as I mentioned. Is there any other way of knowing whether a device is an iPad? – Saamer Jun 22 '22 at 04:12

1 Answers1

2

UIDevice.current.userInterfaceIdiom is not about device but about currently active interface idiom of the supported, but which you actually turned off.

You can use UIDevice.current.model property to detect if real device is iPad.

Asperi
  • 228,894
  • 20
  • 464
  • 690