-
3 Feb 2013 4:17 AM #1
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!
-
Best Answer Posted by squarefan
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.
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.Code:my = new Object(); my.function1 = function(val1, val2, val3) { // do something } my.function2 = function(val1) { // do more }
hope that helps!
-
8 Mar 2013 10:42 AM #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.
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.Code:my = new Object(); my.function1 = function(val1, val2, val3) { // do something } my.function2 = function(val1) { // do more }
hope that helps!


Reply With Quote