Hello,
i'm trying to store data in the App properties, i'm using the following method:
var global_list = Titanium.App.Properties.getList('global_list'); alert(global_list.length); var order_row = { row_id:id, row_image:image }; global_list.push(order_row); Titanium.App.Properties.setList('global_list', global_list);
when compiling i'm gettign this error:
[ERROR] Script Error = Result of expression 'Titanium.App.Properties.getList('global_list')' [null] is not an object. at addItem.js (line 191).
1 Answer
Accepted Answer
Hi Wassim Ghannoum,
If you want to use properties then you have to first initialize first before use it. try below code.
var global_list = Titanium.App.Properties.getList('global_list',[]); alert(global_list.length); var order_row = { row_id:id, row_image:image }; global_list.push(order_row); Titanium.App.Properties.setList('global_list', global_list); var global_list2 = Titanium.App.Properties.getList('global_list',[]); alert(global_list2.length);
Your Answer
Think you can help? Login to answer this question!