Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10915] iOS: cannot push element to array if array is property of view

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.0.2, Release 2.1.2, Release 2.1.3, Release 3.0.0, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, parity, qe-ios090112, reprod
ReporterDustin Hyde
AssigneeUnknown
Created2012-09-13T17:38:46.000+0000
Updated2018-02-28T20:03:37.000+0000

Description

If a JavaScript array is added to a View as a property of that view, and the push method is called on that array, the push operation will fail to append an element to the array. This is not a regression. This is a parity issue. This does not occur on Android or MobileWeb. Steps to Reproduce: 1. Run code:
var view = Ti.UI.createView();

var standard_array = ['Element 0'];
standard_array.push('Element 1'); // works
Ti.API.info('standard_array == ' + standard_array);

view.array_property = ['Element 0'];
view.array_property.push('Element 1'); // doesn't work
Ti.API.info('view.array_property == ' + view.array_property);

alert(standard_array + ' == ' + view.array_property);
Actual Result: Element 1 is not pushed to the array attached to the View.
> 
Sep 13 17:34:27 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [DEBUG] Reading stylesheet from: /var/mobile/Applications/D40E2327-725E-44BB-AFAD-0C98850835D3/InventoryApp.app/stylesheet.plist
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [INFO] InventoryApp/1.0 (2.1.3.v20120907163110.9699f0a)
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [DEBUG] Analytics is enabled = YES
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [DEBUG] Loading: /var/mobile/Applications/D40E2327-725E-44BB-AFAD-0C98850835D3/InventoryApp.app/app.js, Resource: app_js
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [INFO] standard_array == Element 0,Element 1
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [INFO] view.array_property == Element 0
Sep 13 17:34:28 unknown kernel[0] <Debug>: launchd[152] Builtin profile: container (sandbox)
Sep 13 17:34:28 unknown kernel[0] <Debug>: launchd[152] Container: /private/var/mobile/Applications/D40E2327-725E-44BB-AFAD-0C98850835D3 [69] (sandbox)
Sep 13 17:34:28 unknown UIKitApplication:com.appcelerator.qeinventory[0xde08][152] <Notice>: [DEBUG] Application booted in 307.618976 ms
Expected Result: Element 1 should be pushed to the array attached to the view.

Comments

  1. Shameer Jan 2013-03-26

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
  2. Dustin Hyde 2013-03-26

    Current Stable Titanium Studio: 3.0.2.201302191606 Current RC Titanium Studio: 3.1.0.201303240100
  3. Lee Morris 2017-06-22

    I am able to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170620103414 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source