Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Attempt to insert non-property value Warning in Info

Could someone shed some light on this warning for me;

I am creating an empty array and then adding an object, in the case the current window, procs_window and I get a warning as follows:

*** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '(
"[object TiUIWindow]"
)' of class '__NSArrayM'.

Code excerpt:

var procs_window = Titanium.UI.currentWindow;
var appwindows = [];
appwindows.push(procs_window);
Titanium.App.Properties.setList('appwindows', appwindows);

have also tried below with same warning:

var appwindows = [];
var procs_window = Titanium.UI.currentWindow;
appwindows[0] = procs_window;
Titanium.App.Properties.setList('appwindows', appwindows);
— asked November 30th 2010 by Michael Updegraff
  • array
  • non-property
  • warning
0 Comments

2 Answers

  • you are not going to be able to store the window objects in the Titanium.App.Properties.

    My suggestion is that you just create a global variable that holds the window list.

    Also properties are persisted across application sessions, is that what you really wanted to do with the window list?

    — answered December 1st 2010 by Aaron Saunders
    permalink
    4 Comments
    • @Aaron - thank you for the reply. I was managing the properties with removeProptery(). I am storing the windows in an array to loop through and close them when I get to the last window of a tabGroup. See my previous q here: http://developer.appcelerator.com/question/83711/closing-all-windows-under-a-tabgroup—need-help

      How can I set a global array in Appcelerator?

      — commented December 1st 2010 by Michael Updegraff
    • i think i responded to the original question :-) I think the solution I posted above will work for you

      — commented December 1st 2010 by Aaron Saunders
    • @Aaron it appears that as I transcend each new window the array loses its content. See below output from the info window in Titanium.

      [INFO] (
      "[object TiUIWindow]"
      )
      [INFO] 1
      [INFO] (
      "[object TiUIWindow]"
      )
      [INFO] 1
      [INFO] (
      "[object TiUIWindow]"
      )
      [INFO] 1
      Wed Dec 1 09:17:29 MacBook-Pro-2.local Pricedoc[10750] <Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0.
      [INFO] (
      "[object TiUIWindow]"
      )
      [INFO] 1
      

      The CGImageCreateWithImageProvider is a bug with the MapViews

      — commented December 1st 2010 by Michael Updegraff
    • I am going to see if I create the array in app.js and pass the array to each window via win.windowList and push items into it at each window.

      — commented December 1st 2010 by Michael Updegraff
  • here is one way to create a global window list

    // myGlobal.js
    myGlobals = {
        windowList : new Array()
    };
    

    then every js where you want to use the globals, just include the file and use it

    Titanium.include('myGlobals.js');
    
    var win1 = Titanium.UI.createWindow({
        title : 'Tab 1',
        backgroundColor : '#fff'
    });
    
    myGlobals.windowList.push(win1);
    Ti.API.info(myGlobals.windowList);
    Ti.API.info(myGlobals.windowList.length);
    
    — answered December 1st 2010 by Aaron Saunders
    permalink
    1 Comment
    • -1 doesnOt works in alloy…

      — commented August 9th 2014 by Omar Hassan
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.