UIImpactFeedbackGenerator not working

I'm trying to use the new UIImpactFeedbackGenerator for haptic feedback, but it isn't working.

  • Testing on iPhone 7
  • iOS 10.1.1
  • System Haptic setting is enabled

I'm using the following code example in Objective-C

UIImpactFeedbackGenerator *myGen = [[UIImpactFeedbackGenerator alloc] init];
[myGen initWithStyle:(UIImpactFeedbackStyleMedium)];
[myGen impactOccurred];
myGen = NULL;

I'm triggering it inside a UILongPressGestureRecognizer delegate.

Any idea what the problem might be?

Vibration would not work because it's way too powerful. Haptic feedback is what is used in a picker. It's very mild and had different types of vibration. It's invoked whenever a user sliders there finger accross a graph or needs feedback for some sort of minor event.

I had the same issue, it turned out that while working with real time camera input, UIImpactFeedbackGenerator will not give any haptic feedback

If your microphone isn’t working, ensure it’s securely connected to your PC. If the connection is a bit loose, it may appear to be plugged in fine, but may just not work. Pull out the cable—whether it’s a USB microphone or just a traditional audio jack—and plug it back in to ensure the connection is secure.

I asked an Apple Engineer at WWDC 2017 why my haptic request would sometimes fail, and he had me call impactOccurred on the next run loop like this:

[self.feedbackGenerator performSelector:@selector(impactOccurred) withObject:nil afterDelay:0.0f];

Worked like a charm!

Hi. Thanks for your reply. I did what you suggested with assign layer.bounds after adding preview layer. It did not work. And yes, I do use autoLayout. I will happy to know if you have any other ideas. Thanks – drsealks Apr 24 '16 at 19:43

Pitfall: Does not work along with other audio session. There is a note:. However, the device does not vibrate if your app’s audio session is configured with the

I would to be able to use my printer . I have touch screen HP desktop computer hooked up directly to the router for cable internet and the printer is directly hooked up to the computer by a USB cord and wireless . I was running windows 7or8 not sure which but I did install the update after a system restore to update to windows 10 .

When your camera isn't working in Windows 10, it might be missing drivers after a recent update. It's also possible that your anti-virus program is blocking the camera, your privacy settings don't allow camera access for some apps, or there's a problem with the app you want to use.

  • It is recommended to call prepare before calling impactOccurred, have you tried that?
  • @donnywals yeah, i tried that as well, didn't help :/
  • Have you tried not releasing myGen it in the same method ? Also, try moving the declaration of your generator somewhere earlier in the lifecycle and make sure you prepare it before firing. Does this help ?
  • Still not working for me. I noticed that if I print the feeback object, it says it is not prepared, even when I do call prepare as well.