Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24314] iOS: Ti.UI.iOS.FeedbackGenerator crashes on kroll-thread

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-01-25T11:49:35.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.2
ComponentsiOS
Labelshaptic-engine, ios, ios10, iphone7
ReporterHans Knöchel
AssigneeHans Knöchel
Created2017-01-16T18:58:52.000+0000
Updated2017-01-25T11:49:40.000+0000

Description

TIMOB-23891 brought us iOS 10 haptic engine support for the iPhone 7 and later. This is great! But unfortunately, it crashes when running on kroll-thread, because the methods require the main-thread internally. Since I caused this, I'll fix it :-)

Comments

  1. Hans Knöchel 2017-01-16

    PR: https://github.com/appcelerator/titanium_mobile/pull/8756 Test-Case:
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
       
       btn.addEventListener('click', function() {
           var feedback = Ti.UI.iOS.createFeedbackGenerator({
               type: Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION
           });
           feedback.prepare();
           feedback.selectionChanged();
       });
       
       win.add(btn);
       win.open();
       
  2. Hans Knöchel 2017-01-23

    PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8771
  3. Andy Waldman 2017-01-23

    Tested 23th january 2017: After creating a new classic app with environment: MacOS:10.12.1 XCODE: 8.2.1 GM (golden master) APPC CLI Core: 6.1.0 APPC CLI NPM: 4.2.8 SDK: 6.0.2.v20170123062940 Studio build: 4.8.1.201612050850 NPM: 2.15.9 Node: 4.5.0 Steps: 1) create a new classic app 2) copy into app.js
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
        
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
        
       btn.addEventListener('click', function() {
           var feedback = Ti.UI.iOS.createFeedbackGenerator({
               type: Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION
           });
           feedback.prepare();
           feedback.selectionChanged();
       });
        
       win.add(btn);
       win.open();
       
    3) change the main thread to false
       <property name="run-on-main-thread" type="bool">false</property>
       
    4) run the code in the current 6.0.2 sdk 5) using an iphone 7, the taptic engine works on press and no longer forces a close 6) do the same as step 3 but change to "true" 7) The same outcome, the app does not crash 8) To make sure that the crash did happen i used the 6.0.1GA and did steps 3-7 and when the main thread was false the app did crash when it was true the app did not crash 9) To finalize this fix has been verified for 6.0.2 This ticket has been verified

JSON Source