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