iphone - How to implement a callback with phonegap -
working on testing phonegap on iphone; have plugin returns simpl json data :
nsstring* retstr = [[nsstring alloc] initwithformat:@"%@({ code: '%@', image: '%@' });", resulttext.text,resultimage.image]; [ webview stringbyevaluatingjavascriptfromstring:retstr ];
and call js :
var mydata = phonegap.exec("mymodile.myfunction", 'mycallback'); function mycallback (data) { alert (data); }
doesn't produce upon return.
any idea ?
// callback arguments nsstring * jscallback = [arguments objectatindex:0]; // create string nsstring* retstr = [[nsstring alloc] initwithformat:@"%@({ code: '%@', image: '%@' });", jscallback,resulttext.text,resultimage.image]; //execute [ webview stringbyevaluatingjavascriptfromstring:retstr ];
Comments
Post a Comment