0
我已经创建了一个项目科尔多瓦科尔多瓦创建sampleApp com.sample.app sampleApp 后来再也科尔多瓦平台添加iOS和再科尔多瓦插件添加科尔多瓦 - 插件设备项目科尔多瓦IOS插件没有找到当我运行
文件:
平台/ IOS/ios.json
在我添加了一些所谓的sayHelloPlugin下面的JSON内的自定义插件的ios.json
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {
"config.xml": {
"parents": {
"/*": [
{
"xml": "<feature name=\"Device\"><param name=\"ios-package\" value=\"CDVDevice\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"sayHelloPlugin\"><param name=\"ios-package\" value=\"sayHelloPlugin\" /></feature>",
"count": 1
}
]
}
}
}
},
}
个
平台/ IOS/sampleApp/config.xml中
在config.xml中还我已经添加
<feature name="sayHelloPlugin">
<param name="ios-package" value="sayHelloPlugin" />
</feature>
WWW/JS/index.js 我添加调用本地目标C用作
cordova.exec(sayHelloSuccess, sayHelloFailure, "SayHelloPlugin", "sayHello", [name]);
function test(){
alert("Received Event");
}
function sayHelloSuccess(data){
alert("Success");
}
function sayHelloFailure(data){
alert("Error");
}
而且我的目标类是什么样子
#import "SayHelloPlugin.h"
@implementation SayHelloPlugin
- (void)sayHello:(CDVInvokedUrlCommand*)command{
NSString *responseString =
[NSString stringWithFormat:@"Hello %@", [command.arguments objectAtIndex:0]];
CDVPluginResult *pluginResult =
[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:responseString];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
当我做一个科尔多瓦建立ios的构建是成功的。 当我模仿和运行我得到一个错误消息
2016-01-19 05:39:44.017 sampleApp[21225:1854134] CDVPlugin class sayHelloPlugin (pluginName: SayHelloPlugin) does not exist.
2016-01-19 05:39:44.018 sampleApp[21225:1854134] ERROR: Plugin 'SayHelloPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2016-01-19 05:39:44.018 sampleApp[21225:1854134] -[CDVCommandQueue executePending] [Line 159] FAILED pluginJSON = ["SayHelloPlugin535510559","SayHelloPlugin","sayHello",["Hello"]]
如何解决这个问题?
是sayHelloPlugin是我的自定义插件 我提出呼吁cordova.exec(sayHelloSuccess,sayHelloFailure, “SayHelloPlugin”, “sayHello的”,[名]);并且在config.xml和ios.json中添加相同的内容 – user3383301
好的,你是否按照说明添加了自己的插件?你的问题(afaik)没有解决这个问题。 –
我已经更新了这个问题,你可以检查它 – user3383301