【发布时间】:2014-07-22 06:18:01
【问题描述】:
Cordova 3.4 hooks 没有在 iOS 中正确安装提到的插件。我将install_plugins.js 添加到文件夹project/project_root/hooks/after_platform_add 中,其中包含以下代码:
#!/usr/bin/env node
//this hook installs all your plugins
// add your plugins to this list--either the identifier, the filesystem location or the URL
// It can also be git url like "https://github.com/chrisekelley/AppPreferences/"
var pluginlist = [
"org.apache.cordova.camera",
"org.apache.cordova.console",
"org.apache.cordova.contacts",
"org.apache.cordova.device",
"org.apache.cordova.dialogs",
"org.apache.cordova.file",
"org.apache.cordova.file-transfer",
"org.apache.cordova.geolocation",
"org.apache.cordova.globalization",
"org.apache.cordova.media",
"org.apache.cordova.media-capture",
"org.apache.cordova.network-information",
"org.apache.cordova.splashscreen",
"org.apache.cordova.statusbar"
];
// no need to configure below
var fs = require('fs');
var path = require('path');
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {
sys.puts(stdout)
}
pluginlist.forEach(function(plug) {
exec("cordova plugin add " + plug, puts);
});
所以当我使用命令cordova platform add ios 添加平台时,所有插件都已正确安装。
使用命令cordova build ios 构建项目后,日志将显示为** BUILD SUCCEEDED **
但是当我在 Xcode 中运行我的项目时出现以下错误
2014-07-22 11:42:00.960 Totter[2788:90b] CDVPlugin class CDVDevice (pluginName: Device) does not exist.
2014-07-22 11:42:00.961 Totter[2788:90b] ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-07-22 11:42:00.963 Totter[2788:90b] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"Device1460086973",
"Device",
"getDeviceInfo",
[
]
]
2014-07-22 11:42:00.964 Totter[2788:90b] CDVPlugin class CDVConnection (pluginName: NetworkStatus) does not exist.
2014-07-22 11:42:00.965 Totter[2788:90b] ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-07-22 11:42:00.965 Totter[2788:90b] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"NetworkStatus1460086974",
"NetworkStatus",
"getConnectionInfo",
[
]
]
请帮我解决这个问题
【问题讨论】:
-
您解决了这个问题吗?我有完全一样的问题。如果我遇到 RROR: Plugin 'NetworkStatus' not found,问题,我需要手动执行 'cordova plugin add org.apache.cordova.network-information'
-
我也尝试添加
标签: ios cordova phonegap-plugins cordova-plugins