Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17751

iOS8: unable to set object property inside object

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Won't Fix
    • Affects Version/s: Release 3.3.0, Release 3.4.0
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      Mac OS X 10.9.4,
      Titanium Studio: 3.3.0.201407100905,
      Alloy 1.4.0,
      iOS iPad simulator 7.1,

      Also tested with:
      Mobile SDK 3.4.0-RC
      iOS8
      iphone6

      Description

      Problem Description

      If I have an object (status:{}) inside an object (Ti.UI.View), and I want to edit/add a new property to 'status', in android works perfectly, but on iOS it doesn't change the property, defined on 'Ti.UI.View' creation.

      Steps to reproduce

      1. Create a new mobile project (Classic Titanium)
      2. Paste this sample into app.js:

      var win = Titanium.UI.createWindow({  
          backgroundColor:'#000',
          layout:'vertical'
      });
       
      var APPNAME = {
          "UI":{
              "Buttons":function(props) {
        
                  var button = Ti.UI.createView({
                      top:100,
                      height:200,
                      status:{
                          selected:false,
                          inactive:false
                      },
                      backgroundColor:"white",
                      select:function(sttz) {
            
                          if(sttz) {
                               
                              this.status["selected"] = true;
            
                              this.backgroundColor = "red";
                          }
                          else {
                               
                              this.status["selected"] = false;
            
                              this.backgroundColor = "white";
                          }
            
                          console.log("selected status: "+this.status.selected);
            
                      }
                  });
                   
                  button.addEventListener("click",function() {
        
                      if(!this.status.selected) {
                          this.select(true);
                      }
                      else {
                          this.select(false);
                      }
                    
                  });
        
                  return button;
              }
          }
      };
       
      var exemple_btn = APPNAME.UI.Buttons();
      win.add(exemple_btn);
      win.open();
      

      3. Run it in device.
      4. Click on the White box. It should turn red. Click in the red box. It should turn white. Repeat.

      Expected Results

      When you click in the box, it should go from white to red and viceversa.

      Actual Results

      It's working fine in Android, failing in iOS.

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              ricardo_jcp Ricardo Pereira
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-19253
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration