0
我尝试安装this phonegap ios插件,但它给出错误“错误:插件”未找到,或不是CDVPlugin。检查插件映射config.xml中“。在我的config.xml无法在科尔多瓦创建一个phonegap ios插件2.4
<plugin name="Flurry" value="FlurryPhoneGapPlugin" />
和plugin.js
cordova.exec(successCallback, successCallback, 'Flurry', 'startSession', [key]);
,和插件的.h文件中
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface FlurryPhoneGapPlugin : CDVPlugin
FlurryPhoneGapPlugin.m文件
#import "FlurryPhoneGapPlugin.h"
#import <Cordova/CDV.h>
@implementation FlurryPhoneGapPlugin
服务名称和操作名称,Objective c Classname是相同的在config.xml中,
收到此错误后,我尝试插件根据this
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface FlurryPhoneGapPlugin : CDVPlugin
- (void)myMethod:(CDVInvokedUrlCommand*)command;
@end
和.m文件创建自己的简单的echo
#import "FlurryPhoneGapPlugin.h"
#import <Cordova/CDV.h>
@implementation FlurryPhoneGapPlugin
(void)myMethod:(CDVInvokedUrlCommand*)command{
NSLog(@"hi");
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
我plugin.js文件
cordova.exec(success, error , 'Flurry', 'myMethod', ['19']);
my config.xml
<plugin name="Flurry" value="FlurryPhoneGapPlugin" />
但这个时候还我得到错误
2013-03-19 10:30:46.349 artra[15560:707] ERROR: Plugin 'Flurry' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-03-19 10:30:46.354 artra[15560:707] -[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = [
null,
"",
"success",
[
"error",
"Flurry",
"myMethod",
[
"19"
]
]
]
http://stackoverflow.com/questions/14368597/how-do-i-write-basic-hello-world-java-script-电话插件 – Parvathy 2013-03-19 05:35:27
#导入 –
Parvathy
2013-03-19 05:37:33