2012-03-22 114 views
2

不确定我创建了一个项目科尔多瓦在Xcode 4添加我的插件在Cordova.plist,但在cordova.js我得到以下错误: 在FUNC:Cordova.exec插件管理科尔多瓦JS

在该行中:

var v = cordova.PluginManager.exec(success, fail, service, action, args);

cordova.PluginManager未定义。

你知道为什么吗?

感谢。

回答

1

我是Cordova的新手,但基于我所见,您可能需要确保Cordova已加载。要调用插件科尔多瓦加载完成后,做在你的JavaScript文件如下:

// Wait for Cordova to load 
document.addEventListener("deviceready", onDeviceReady, false); 

// Cordova is ready 
function onDeviceReady() { 
    // As an example, you now have the device name, Cordova version, etc. available 
    alert('Device Name: ' + device.name); 
    alert('Device Cordova: ' + device.cordova); 
    alert('Device Platform: ' + device.platform); 
    alert('Device UUID: ' + device.uuid); 
    alert('Device Version: ' + device.version); 

    // Now call plugin, etc. 
    var v = cordova.PluginManager.exec(success, fail, service, action, args); 
} 

更多信息请参见http://docs.phonegap.com/en/2.0.0/cordova_device_device.md.html#Device

Cordova documentation for iOS plugins提供了额外的细节。