I would like to use some haptic in my app. I am using the UISelectionFeedbackGenerator
but it will not work. I am testing on real iPhone 7 with iOS 10. These two lines should do the magic – but nothing happens:
let generator = UISelectionFeedbackGenerator()
generator.selectionChanged()
It seems as if AVFoundation
(or probably just AVCaptureSession
) is somehow messing with the haptic feedback! Without AVFoundation
, my haptic feedback works. As soon as I put it in there, it stops working.
Here are some alternatives that work on older devices:
import AudioToolbox
AudioServicesPlaySystemSound(1519) // Actuate `Peek` feedback (weak boom)
AudioServicesPlaySystemSound(1520) // Actuate `Pop` feedback (strong boom)
AudioServicesPlaySystemSound(1521) // Actuate `Nope` feedback (series of three weak booms)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With