我是Cordova的新手,我正在为sim信息开发一个测试应用程序。我正在使用 cordova-plugin-sim
我收到错误:
类型错误:无法调用方法getSimInfo
以防万一,我也使用了振动插件,它工作正常。
window.plugins.sim.getSimInfo(successCallback, errorCallback);
每当我使用window.plugins
来调用插件的功能时,我都会收到 Type Error
我正在关注this link的教程
没有window.plugins
的情况下使用的插件工作正常。
请帮助,谢谢!
代码如下:
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady(){
try{ cordova.plugins.sim.getSimInfo(successCallback, errorCallback);}
catch(ex){alert("error "+ex);}
}
function successCallback(result) {
try{document.getElementById("simInfo").innerHTML=JSON.stringify(result);}
catch(ex){alert("error "+ex);}
}
function errorCallback(error) {
document.getElementById("simInfo").innerHTML=JSON.stringify(result);
}