We are using the following code to check for the haptics support on the device
import CoreHaptics
let hapticCapability = CHHapticEngine.capabilitiesForHardware()
let supportsHaptics: Bool = hapticCapability.supportsHaptics
For some reason it returns false
on iPhone 7 not only on my personal device (iOS 13) but some of our users reported the haptic settings missing from our app on iPhones 7 (iOS 15) as well.
I have just checked with this private api call that in fact the devices does support haptics (obviously, it has not physical home button)
extension UIDevice {
var feedbackSupportLevel: Int? {
value(forKey: "_feedbackSupportLevel") as? Int
}
}
let supportsHaptics: Bool = UIDevice.current.feedbackSupportLevel == 2
And it returns true
, as expected.
Weird thing is that the haptics work perfectly fine, it's just the haptics support status is incorrect.
So my question is: will we be rejected for checking the value of the _feedbackSupportLevel
on UIDevice
just to make sure we are correctly displaying available system features for our users on all of the devices?
Sorry, it may be late... but I wanted to add it's perfectly normal that, when running on an iPhone 7, the CHHapticEngine.capabilitiesForHardware() API returns false. The iPhone 7 has a built-in haptic engine but it's not accessible by the Core Haptics APIs. Like Apple said in a WWDC video, Core Haptics in supported by the iPhones 8 / X and later.