2013-07-22 37 views
3

我正在嘗試使用phonegap 3.0開發iOS應用程序。 該應用程序使用sharekit插件和GAPlugin for phonegap,它在使用phonegap時正在工作2.9 升級後編譯,當我嘗試訪問插件中的函數時,它給了我這個錯誤。錯誤:方法'methodName'未在插件'插件'中定義 - Phonegap 3.0 iOS

 
ERROR: Method 'share:' not defined in Plugin 'ShareKitPlugin' 
2013-07-22 22:05:06.976 -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [ 
    "INVALID", 
    "ShareKitPlugin", 
    "share", 
    [ 
    "test", 
    "http:\/\/www.test.com" 
    ] 
] 

ERROR: Method 'initGA:' not defined in Plugin 'GAPlugin' 
2013-07-22 22:05:06.977 -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [ 
    "GAPlugin1900170756", 
    "GAPlugin", 
    "initGA", 
    [ 
    "UA-XXXXXX-11", 
    10 
    ] 
] 

回答

8

如果TRU使用PhoneGap的3.0「老」的插件,你應該砍在本機代碼編寫插件方法。例如:

- (void)register:(CDVInvokedUrlCommand*)command 
{ 
    self.callbackId = command.callbackId; 
    NSArray *arguments = command.arguments; 
    NSDictionary *options = [arguments objectAtIndex:0]; 

,而不是

- (void)register:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options 
    self.callbackId = [arguments pop]; 
+0

最後,幾乎花了一天後問題 - 這解決了它。謝謝 –

7

GAPlugin還不支持Phonegap在2.1.0中引入的新插件簽名。 Phonegap/Cordova 3.0.0不再支持舊的插件簽名。

新的簽名是:

- (void)myMethod:(CDVInvokedUrlCommand*)command; 

的GAPlugin仍然使用:

  • (無效)initGA:(NSMutableArray的*)參數withDict:(*的NSMutableDictionary)選項;

(有關更多詳細信息,請參閱https://github.com/phonegap-build/GAPlugin/blob/master/src/ios/GAPlugin.h)。

這似乎也適用於ShareKit插件。

+0

謝謝floerkem我相應地更新這兩個插件,它的工作 –

相關問題