[TIMOB-23891] iOS 10: Support iPhone 7 Haptic Engine API
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-10-06T08:25:50.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.0.0 |
Components | iOS |
Labels | ios, ios10, qe-6.0.0 |
Reporter | Donovan Lewis |
Assignee | Hans Knöchel |
Created | 2016-09-09T23:48:28.000+0000 |
Updated | 2018-10-20T09:28:50.000+0000 |
Description
iOS 10 exposes new API's for the iPhone 7 for generating feedback when an action happens through a new Haptic Engine API and
UIFeedbackGenerator
. This would be great to be exposed for all Ti users.
https://developer.apple.com/ios/human-interface-guidelines/interaction/feedback/
https://www.hackingwithswift.com/example-code/uikit/how-to-generate-haptic-feedback-with-uifeedbackgenerator
Thanks for the ticket! I searched for the correct API's yesterday but couldn't find them. It seems like it is all about the
UIFeedbackGenerator
subclasses, am I correct? There not seem to be any docs about that, yet.PR (master): https://github.com/appcelerator/titanium_mobile/pull/8342 PR (6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8389 Demo:
The only other documentation I have been able to find on it is: https://developer.apple.com/ios/human-interface-guidelines/interaction/feedback/ The hackingwithswift article was the only thing I could find with some bit of how it works. Apple says it needs to be Prepared but there isn't much right now on how to work with this thing. I looks like UINotificationFeedbackGenerator is the most important. Thanks for adding this to TI.
[~cng] to review this PR. Since we are *very* early with this PR and the iPhone 7 is not even out, yet, testing can be done through debugging debugging the methods-calls through Xcode as I did.
Sorry for the delay here...I really like the idea of supporting this capability. I agree with the Hyperloop statement and that would be ideal but Han's point is key as to who can have access to this without us exposing it directly.
Just tested the API on a real iPhone 7 device. Works without further adjustments!
I tried to get this to work on my iPhone 7 but was unable to. I can get it to work in the simulator but on device it will throw errors. On device using the same code provided I get "undefined is not a function (evaluating 'Ti.UI.iOS.createFeedbackGenerator(i)') at app.js (line 1)" I'm sure it works, I tried adding it into a build of 6.0.x and 6.1.x I have have done something wrong there but can't see anything I did going over it so hopefully just a mistake I made somewhere.
[~dlewis23] That's because it's status is
In Review
meaning that it is not merged, yet.CR AND FT PASSED. Tested with sample code and the following constants: Ti.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_ERROR Ti.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_WARNING Ti.UI.iOS.FEEDBACK_GENERATOR_NOTIFICATION_TYPE_SUCCESS Ti.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_LIGHT Ti.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_MEDIUM Ti.UI.iOS.FEEDBACK_GENERATOR_IMPACT_STYLE_HEAVY
I can report that I am experiencing the same behaviour as [~dlewis23] has described. Using the provided sample code and running to an iPhone 7 Device, I see the following error when selecting any of the FEEDBACK_GENERATOR_TYPES:
This does not occur on simulator. Checked that selected SDK
6.0.0.v20161101155110
had the merged files present. Tested On: iPhone 7 10.0.3 Device & Simulator Mac OS Sierra (10.12) Ti SDK: 6.0.0.v20161101155110 Appc Studio: 4.8.0.201610060953 Appc NPM: 4.2.8-9 App CLI: 6.0.0-68 Xcode 8.0 Node v4.4.7Fixed the device-issue in [#8576](https://github.com/appcelerator/titanium_mobile/pull/8576) and [#8577](https://github.com/appcelerator/titanium_mobile/pull/8577), thx!
Verified as fixed, tested the various available constants and can confirm that they work without issue Tested On: iPhone 7 10.1.1 Device & Simulator Mac OS Sierra (10.12.1) Ti SDK: 6.0.0.v20161102104808 Appc Studio: 4.8.0.201610060953 Appc NPM: 4.2.8-9 App CLI: 6.0.0-68 Xcode 8.1 Node v4.4.7 *Closing ticket.*
Hi guys, I'm trying to use this feature on an iPhone 7 with iOS 11.4.1 and the latest Ti SDK 7.4.1.GA with this code:
I got the same error as reported in this issue: