1. #1
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
    squarefan is on a distinguished road

      0  

    Default Answered: Call function from Objective-C within Ext Application launch

    Answered: Call function from Objective-C within Ext Application launch


    Hi,

    I need to call a function I have written and that is located within 'launch' of the touch app. I know how to fire javascript functions via Objective-C but the problem I am facing is I don't know how to call the function within Ext. I am sure there is a simple way like:

    Ext.app.get....

    Basically I need to call it and pass values...

    Anybody an idea? Help is much appreciated.

    thanks!

  2. For anybody who is facing the same issue. I managed to get it working by just creating a new object within the Sencha app and then reference the functions that way. e.g.

    Code:
    my = new Object();
    
    my.function1 = function(val1, val2, val3) {
        // do something
    }
    
    my.function2 = function(val1) {
      // do more
    }
    you can then call the functions from Objective-C via the default UIWebView bridge 'vg.function1(1,2,3)'. Keep in mind though that if you want to return an array to Objective-C you have to nest that in brackets as a string ('['+array+']') as native functions always expects a string as return value.

    hope that helps!

  3. #2
    Sencha Premium Member
    Join Date
    Aug 2008
    Posts
    209
    Answers
    4
    Vote Rating
    4
    squarefan is on a distinguished road

      0  

    Default


    For anybody who is facing the same issue. I managed to get it working by just creating a new object within the Sencha app and then reference the functions that way. e.g.

    Code:
    my = new Object();
    
    my.function1 = function(val1, val2, val3) {
        // do something
    }
    
    my.function2 = function(val1) {
      // do more
    }
    you can then call the functions from Objective-C via the default UIWebView bridge 'vg.function1(1,2,3)'. Keep in mind though that if you want to return an array to Objective-C you have to nest that in brackets as a string ('['+array+']') as native functions always expects a string as return value.

    hope that helps!