Is there a quick way to determine if the iPhone model is newer than a certain model?

291 views Asked by At

I am trying to apply the Haptic vibration effect. But it looks like that only iPhone 7 or later support this cool feature. I have already read this thread.

How to determine the current iPhone/device model?

Is there a function I can use to just determine if the device is iPhone 7 or a newer device? If I use the SWITCH statement, I will have to submit an update to App Store each time Apple releases new devices. So there will be a couple of days the App doesn't work on the new released devices.

EDIT: On iPhone 6 or lower, I would use the normal Vibration so that I need to know if the the device is newer than iPhone 7. Or it will just do nothing on iPhone 6 or older devices. AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))

1

There are 1 answers

1
Scriptable On

According to the documentation for Feedback Generators, you trigger the events and the system handles the way the feedback is given to the user if the OS and device supports it.

So you shouldn't need to check if it is available, just trigger the events as per the guidelines and if available, it will do it.

If you really want to check the device version, the switch/case statement used in the answer you mentioned is quite thorough, If an unknown device was returned you could presume that it is a new device and more than likely supports this feature.