Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15205] iOS7: Value not changed at touchEnd event of Switch

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2015-12-17T02:45:12.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0
ComponentsiOS
Labelsios7, ipass1
Reporternicolomonili
AssigneeAngel Petkov
Created2013-09-13T15:28:24.000+0000
Updated2017-03-29T22:36:05.000+0000

Description

The "change" event of the switch on iOS 7 with SDK 3.1.3 (and Apple iOS 7 SDK) behaves differently than the previous SDK (for example with the 3.0.2 SDK and Apple iOS 6 SDK) basically if you run the movement shown in the video attached, the "change" event is invoked, although actually at the "touchEnd" of the finger on the switch the switch has not really changed the value.

Attachments

FileDateSize
switch iOS 6.mov2013-09-16T07:00:20.000+00002377762
switch ioS 7.mov2013-09-16T06:58:02.000+0000798123
video2.mov2013-09-13T15:28:25.000+0000252911

Comments

  1. Ingo Muschenetz 2013-09-16

    [~vduggal], thoughts?
  2. nicolomonili 2013-09-16

    I saw that you changed the title of the ticket in "Value not changed at touchEnd event of Switch", but in reality that's not the problem the fact is that (with the iOS 7 SDK) if I continue to change the value of the switch (never release the finger) the event change is called. but it should not be so! the event of change should only be called "at the end of the movement on the switch" ("touchEnd finger say")
  3. nicolomonili 2013-09-16

    ok, I made these two videos to help you understand the problem first video made with the SDK 3.1.3.v20130908095038 of titanium, Apple iOS 7 SDK , simulator iOS 7 (incorrect working) second video made with the SDK 3.1.3.v20130908095038 of titanium, Apple iOS 7 SDK , simulator iOS 6.1(correct working) (video added to Attachments)
  4. Vishal Duggal 2013-09-16

    When apple says change we fire change. We don't actually track touches for sliders, switches and the like. Not our bug.
  5. Ingo Muschenetz 2013-09-16

    [~nicolomonili] If you believe this is still a bug of ours, please provide a test case and we'll take a look. Thanks!
  6. nicolomonili 2013-09-16

    bug or not, it is unthinkable that the "change" event, now , behaves as I described! it is not possible that the event will unleash all those times as shown in the video this is a sample code
       var switch = Ti.UI.createSwitch({
           value : true
       });
       
       
       switch.addEventListener('change',function(e){
          Ti.API.info("change event call"); 
       });
       
  7. Eric Merriman 2013-09-16

    Verified behavior as described occurs with iOS 7 and does not occur on iOS 6 with sample code below: Please note, "switch" is a reserved word. This might cause unexpected behavior, and may throw code errors in Studio. (Ticket to be opened on this subject)
       var win= Ti.UI.createWindow();
       
       var mySwitch = Ti.UI.createSwitch({
           value : true
       });
        
       mySwitch.addEventListener('change',function(e){
          Ti.API.info("change event call"); 
       });
       
       win.add(mySwitch);
       
       win.open();
       
    Steps to reproduce: 1) Install to device or simulator 2) Monitor console 3) Tap or swipe to change switch state Result - works as expected, but occasionally swipe will generate more than one change event 4) Press and drag off the control Result - change event thrown until finger lifted
  8. nicolomonili 2013-09-16

    I know that switch is a reserved word , in fact, in my tests do not use. I used in this case to show the code
  9. Eric Merriman 2013-09-16

    [~nicolomonili] That comment was more for the QE team. When a ticket is fixed, we use the code from the original ticket to create a test case. I added the window for the same reason.
  10. Blain Hamon 2013-09-16

    Pull merged.
  11. Sabil Rahim 2013-09-16

    31X https://github.com/appcelerator/titanium_mobile/pull/4696 master https://github.com/appcelerator/titanium_mobile/pull/4695
  12. Sabil Rahim 2013-09-16

    Test case
        var win = Ti.UI.createWindow({
          backgroundColor: 'white'
        });
        
        var basicSwitch = Ti.UI.createSwitch({
          value:true // mandatory property for iOS 
        });
        win.add(basicSwitch);
        
        basicSwitch.addEventListener('change',function(e){
          Ti.API.info('Switch value: ' + basicSwitch.value);
        });
        
        win.open();
        
        // print initial value
        Ti.API.info('Switch value: ' + basicSwitch.value);
        
  13. Priya Agarwal 2013-09-17

    Verified the fix with: Appcelerator Studio: 3.1.3.201309132456 SDK: 3.1.3.v20130916153052 acs:1.0.6 alloy:1.2.2-cr npm:1.3.2 titanium:3.1.2 titanium-code-processo:1.0.2 OSX: 10.8.4 Xcode:5.0 GM seed Devices:ipad3(v7.0),ipod touch3(v6.1.3)
        var win= Ti.UI.createWindow();
         
        var mySwitch = Ti.UI.createSwitch({
            value : true
        });
          
        mySwitch.addEventListener('change',function(e){
           Ti.API.info("change event call"); 
        });
         
        win.add(mySwitch);
        win.open();
        
        
    Using the above code have verified the fix. the event of change is being called only once at the end of the movement on the switch. Hence closing the issue.
  14. nicolomonili 2015-10-07

    SDK 5.0.2 and iOS 9. The issue has come back
  15. Ingo Muschenetz 2015-10-07

    [~nicolomonili] a test case please, along with your environment.
  16. nicolomonili 2015-10-07

    i have a video on iOS 9 , but i can't post it if the issue is CLOSED
        var win= Ti.UI.createWindow();
         
        var mySwitch = Ti.UI.createSwitch({
            value : true
        });
          
        mySwitch.addEventListener('change',function(e){
           Ti.API.info("change event call"); 
        });
         
        win.add(mySwitch);
        win.open();
        
  17. Ingo Muschenetz 2015-10-07

    FYI
  18. Ingo Muschenetz 2015-10-07

    Reopened. What was the last SDK you used where it worked?
  19. nicolomonili 2015-10-07

    I noticed now that the problem is also on iOS 8 with the SDK 3.5.1
  20. Ingo Muschenetz 2015-10-07

    Try 3.5.1 on iOS 7.
  21. nicolomonili 2015-10-07

    SDK 3.5.1 , iOS 7 simulator : i have this error
        [ERROR] :  Invalid "--sim-version" value "7.1"
        Accepted values:
           9.0
        For help, run: titanium help build
        TRACE  | titanium exited with exit code 1
        ERROR  | Error: ti run exited with error code 1
            at ChildProcess.<anonymous> (/Users/nicolo/.appcelerator/install/5.0.2/package/node_modules/appc-cli-titanium/plugins/run.js:89:66)
            at ChildProcess.EventEmitter.emit (events.js:117:20)
            at Process.ChildProcess._handle.onexit (child_process.js:789:12)
        
  22. Ingo Muschenetz 2015-10-07

    Ah, try using an older CLI. appc use 4.1.3 and then re-run. You can appc-use 5.0.2 afterwards to get back
  23. nicolomonili 2015-10-07

    SDK 3.5.1 , iOS 7 simulator , cli 4.1.3 and xcode 7
        [ERROR] :  Invalid "--sim-version" value "7.1"
        Accepted values:
           9.0
        For help, run: titanium help build
        TRACE  | titanium exited with exit code 1
        ERROR  | Error: ti run exited with error code 1
            at ChildProcess.<anonymous> (/Users/nicolo/.appcelerator/install/4.1.3/package/node_modules/appc-cli-titanium/plugins/run.js:84:66)
            at ChildProcess.EventEmitter.emit (events.js:117:20)
            at Process.ChildProcess._handle.onexit (child_process.js:789:12)
        
    Xcode error : !https://mega.nz/#!egIXjCSa!1MElnqqprmP-OiRPlsd8bCMe00AvbambMMzP394NaHE!
  24. Ingo Muschenetz 2015-10-07

    Ah, got it. I thought you still had Xcode 6 installed. If you do, and can test, would be helpful to get that data point.
  25. nicolomonili 2015-10-07

    currently i can't install xcode 6 . So , there isn't way to test the issue ?
  26. Ingo Muschenetz 2015-10-07

    [~emerriman] could you take a look?
  27. nicolomonili 2015-10-07

    Video test on iOS 9 , SDK 5.0.2 https://mega.nz/#!S45WSbAK!yBz2FCNRxW5SawKoVWvZ3YpyVL51u55qYwRppvnjfFA
  28. nicolomonili 2015-10-14

    +1
  29. Angel Petkov 2015-11-24

    Hello we've investigated the issue , the video taken on iOS 9 is displaying the native behavior of the switch. If you were to do the same ,dragging of the switch till the end on any of the switches inside the IPhone settings.The behavior will be the same. The event will be called before the touchend. Hope that helps. Thank you!
  30. Lee Morris 2017-03-29

    Closing ticket as invalid.

JSON Source