Cordovacordova/phonegap Cordova开发

Cordova JS OC交互方法

2017-04-19  本文已影响47人  XLsn0w

CDVPluginResult*pluginResult = [CDVPluginResultresultWithStatus:CDVCommandStatus_OKmessageAsString:@""];

[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];

这个就是OC回调JS方法

//这边就是JS发起调用OC函数

cordova.exec(this.testSuccess,this.testFail,"TestPluginName","testPluginFunctionWithArgumentsAndCallBack", [{"name":"小明"}, {"age":"9"}, {"frends": ["小白","小溪"]}]);

上一篇下一篇

猜你喜欢

热点阅读