[英]cannot able to create a phonegap ios plugin in cordova 2.4
i am try to instal this phonegap ios plugin, but it gives an error "ERROR: Plugin '' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml." 我尝试安装这个 phonegap ios插件,但给出错误“ ERROR:Plugin”,或者不是CDVPlugin。请在config.xml中检查您的插件映射。 in my config.xml
在我的config.xml中
<plugin name="Flurry" value="FlurryPhoneGapPlugin" />
and in plugin.js 并在plugin.js中
cordova.exec(successCallback, successCallback, 'Flurry', 'startSession', [key]);
, and plugin .h file 和插件.h文件
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface FlurryPhoneGapPlugin : CDVPlugin
FlurryPhoneGapPlugin.m file FlurryPhoneGapPlugin.m文件
#import "FlurryPhoneGapPlugin.h"
#import <Cordova/CDV.h>
@implementation FlurryPhoneGapPlugin
the service name and action name , Objective c Classname are same in config.xml, 服务名称和操作名称,目标c类名称在config.xml中相同,
after getting this error i try to create my own simple echo plugin according to this 收到此错误后,我尝试根据此方法创建自己的简单echo插件
#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface FlurryPhoneGapPlugin : CDVPlugin
- (void)myMethod:(CDVInvokedUrlCommand*)command;
@end
and .m file 和.m文件
#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
my plugin.js file 我的plugin.js文件
cordova.exec(success, error , 'Flurry', 'myMethod', ['19']);
my config.xml 我的config.xml
<plugin name="Flurry" value="FlurryPhoneGapPlugin" />
but this time also i got error 但是这次我也出错了
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"
]
]
]
In Xcode make sure your config.xml is not 'grey'. 在Xcode中,确保您的config.xml不是“灰色”。 If the file is grey it means it has not yet been saved.
如果文件为灰色,则表示尚未保存。 Failing that try a clean.
失败的尝试干净。
Do let us know if you managed to resolve your problem :) 如果您设法解决了问题,请告诉我们:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.