Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20506] iOS: Ti.App.Properties.setList failes when array element is object with null property

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-10-12T04:16:48.000+0000
Affected Version/sRelease 5.1.1
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsios, list, properties
ReporterJason Knight
AssigneeHans Knöchel
Created2016-03-02T00:21:01.000+0000
Updated2016-11-17T18:44:40.000+0000

Description

When trying to set a list, via "Ti.App.Properties.setList", with an object that has a null value property, I get an Application Error: "Attempt to insert non-property list"
var names = [{
    name: "One"
}, {
    name: null
}];
Ti.App.Properties.setList("names", names);
This error does not happen on Android 6.0.1. *Note:* This issue seems similar to [TIMOB-13127]

Comments

  1. Jason Knight 2016-03-02

    This should be in TIMOB and not TC.
  2. Jason Knight 2016-08-27

    I guess this won't get fixed because nobody else has bothered to report it?
  3. Baharroth 2016-09-13

    I can report it again. Still in SDK 5.4.0
  4. Hans Knöchel 2016-09-13

    PR (Core-SDK): https://github.com/appcelerator/titanium_mobile/pull/8371 PR (Unit-Test): https://github.com/appcelerator/titanium-mobile-mocha-suite/pull/4 Using a generatic attempt too loop through dictionary-values in setList to convert between null- and NSData-values that are required by the internal iOS-API. The test-case contains all kind of possible values, from dictionary (object) over null, undefined, string, number and boolean. Demo:
       var win = Ti.UI.createWindow({
           backgroundColor: "#fff"
       });
       
       var btn1 = Ti.UI.createButton({
           title: "Set list",
           top: 30
       });
       
       btn1.addEventListener("click", function() {
           var names = [{
               name: "One"
           }, {
               name: 1
           }, {
               name: ""
           },
           null, {
               name: true
           }, 1, "", null, false];
           Ti.App.Properties.setList("names", names);
       });
       
       var btn2 = Ti.UI.createButton({
           title: "Get list",
           top: 60
       });
       
       btn2.addEventListener("click", function() {
          Ti.API.warn(Ti.App.Properties.getList("names", []));
       });
       
       win.add(btn1);
       win.add(btn2);
       win.open();
       
    Expected result: - No crashes in getting and setting the property-list - null- and undefined-values are properly accepted in both setter and getter
  5. Eric Wieber 2016-11-17

    Verified fixed, using: MacOS 10.12 (16A323) Studio 4.8.0.201611121409 Ti SDK 6.1.0.v20161117072812 Appc NPM 4.2.9-1 Appc CLI 6.1.0-13 Alloy 1.9.4 Xcode 8.1 (8B62) Arrays objects with null/undefined properties can be set and retrieved with setList and getList, without error.

JSON Source