1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    3
    Vote Rating
    0
    apeace is on a distinguished road

      0  

    Default Unanswered: Uncaught TypeError: Cannot call method 'indexOf' of undefined

    Unanswered: Uncaught TypeError: Cannot call method 'indexOf' of undefined


    Example source here: http://andrewpeace.com/testapp/

    Somehow Ext.gesture.Manager's `addEventListener` method is getting called before its `init` method, resulting in this.targets being undefined.

    This results in the error: "Uncaught TypeError: Cannot call method 'indexOf' of undefined"

    The error doesn't *always* happen. You may need to refresh the example a few times in order to see it.

    I can't figure out for the life of me what I am doing wrong in my source. Any help is greatly appreciated.

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    3
    Vote Rating
    0
    apeace is on a distinguished road

      0  

    Default


    I solved this problem.

    I had defined an action called `init` in one of my controllers. Turns out this causes the action to run as soon as the controller is instantiated, before the app's `launch` event has been fired. Renaming the action made everything run as expected.

    I can't find reference to the special behavior of the `init` action in the Sencha Touch doc. It would be good to put this in there!