手记

Cordova JS OC交互方法

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": ["小白","小溪"]}]);



作者:XLsn0w
链接:https://www.jianshu.com/p/96633eb86cfa


1人推荐
随时随地看视频
慕课网APP