If I deselect iPad as a device that I want to deploy to, as shown below:
and then run my app using debug/TestFlight on my iPad, UIDevice.current.userInterfaceIdiom
(from here) returns phone
instead of pad
.
How can I detect that the app is running on an iPad in this state?
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.
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.