IOS 10 iPhone 6S Play Haptic Feedback or Vibrate Using the Taptic Engine

Iphone6s has a taptic engine or not, can I use an open API called UIFeedbackGeneratorto access it?

+4
source share
3 answers

iPhone 7 has a more accurate and flexible Taptic mechanism than iPhone 6 - you can use the class cluster UIFeedbackGeneratorto access the richer tactile feedback dictionary supported by iPhone 7, but these APIs do not affect iPhone 6s (or other devices).

iPhone 6s - Taptic, , , , 3D Touch. , :

peek/pop, 3D Touch haptics . WWDC16 "Peek at 3D Touch" Apple 3D-Touch iPhone.

+6

iPhone7/7 + , UIFeedbackGenerator, :

let generator = UIImpactFeedbackGenerator(style: .heavy)
generator.prepare()

generator.impactOccurred()

iPhone 6S/6S, , , :

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)

, Haptic : http://www.mikitamanko.com/blog/2017/01/29/haptic-feedback-with-uifeedbackgenerator/

+9

No, taptic currently only works on iPhone 7 and 7+.

Currently, only these new Taptic Engine technologies found in the iPhone 7 and iPhone 7 Plus support these APIs. Other devices silently ignore tactile requests.

https://www.hackingwithswift.com/example-code/uikit/how-to-generate-haptic-feedback-with-uifeedbackgenerator

On iPhone 6s, your device may call UIFeedbackGenerator, but nothing will happen because the phone does not have taptic equipment.

-1
source

Source: https://habr.com/ru/post/1660265/


All Articles