简体   繁体   English

从PhoneGap.exec到Cordova.exec

[英]PhoneGap.exec to Cordova.exec

I'm using a plugin in my Cordova project and it's installed properly, but doesn't work. 我在Cordova项目中使用了一个插件,并且已正确安装,但无法正常工作。 Upon looking into the JS file I found these two lines 在查看JS文件后,我发现了这两行

PhoneGap.exec("SMSComposer.showSMSComposer",args);
PhoneGap.addConstructor(function() {

Obviously the problem is that the PhoneGap.exec function no longer exists, it's Cordova.exec now. 显然问题是PhoneGap.exec函数不再存在,现在是Cordova.exec。 How can I get this working? 我该如何工作? The plugin isn't that old, just a few months so it should work. 该插件不是那么老,只有几个月,所以它应该可以工作。

can u give the cordova version you are using ?, if you are using new phonegap version , use plugin for that version. 您能提供您正在使用的cordova版本吗?如果使用的是新的phonegap版本,请使用该版本的插件。 If it is your custom plugin please follow this Plugin dev guide . 如果它是您的自定义插件,请遵循此插件开发指南 Or check this Upgrading Guides . 或检查此升级指南

  • cordova.exec(function(winParam) {}, function(error) {}, "service", "action", ["firstArgument", "secondArgument", 42, false]); cordova.exec(function(winParam){},function(error){},“ service”,“ action”,[“ firstArgument”,“ secondArgument”,42,false]); The parameters explained in more detail: 有关参数的详细说明:

function(winParam) {} - Success function callback. function(winParam){}-成功的函数回调。 Assuming your exec call completes successfully, this function will be invoked (optionally with any parameters you pass back to it) function(error) {} - Error function callback. 假设您的exec调用成功完成,该函数将被调用(可选地,您可以使用传递给它的任何参数)function(error){}-错误的函数回调。 If the operation does not complete successfully, this function will be invoked (optionally with an error parameter) "service" - The service name to call into on the native side. 如果操作未成功完成,则将调用此函数(可选地使用错误参数)“ service”-在本机端调用的服务名称。 This will be mapped to a native class. 这将被映射到本机类。 More on this in the native guides below "action" - The action name to call into. “操作”下方的本机指南中对此有更多介绍-调用的操作名称。 This is picked up by the native class receiving the exec call, and, depending on the platform, essentially maps to a class's method. 这由接收exec调用的本机类接收,并且根据平台的不同,它实质上映射到类的方法。 For more detail please check out the native guides located at the end of this article. 有关更多详细信息,请查看本文末尾的本机指南。 [/* arguments */] - Arguments to get passed into the native environment [/ * arguments * /]-要传递到本机环境中的参数

links to latest SMS composer Plugin : IOS Link , Android : link 链接到最新的短信编辑器插件:IOS 链接 ,Android: 链接

i think it may help you 我认为这可能对您有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM