Plugin introuvable ou n'est pas un CDVPlugin. Vérifiez votre plugin cartographie config.xml
Je l'ai déclaré à mon fichier de plugin pour iOS à l'intérieur plugin.xml comme:
<config-file target="config.xml" parent="/*">
<feature name="CDVOP">
<param name="ios-package" value="CDVOP"/>
</feature>
</config-file>
<header-file src="src/ios/CDVOP.h" />
<source-file src="src/ios/CDVOP.m" />
Dans le plugin fichier JavaScript que j'ai cette fonction que j'ai ensuite appeler à partir de l'application JavaScript
showCatPictures: function(interval) {
exec(null, null, 'CDVOP', 'showCatPictures', [interval]);
},
Je suis en cours d'exécution de l'application qui utilise ce plugin depuis xcode pour voir la sortie de débogage. Je reçois ce que j'appelle la showCatPictures
fonction:
OP Cordova Tests[1122:60b] ERROR: Plugin 'CDVOP' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-02-14 16:23:45.233 OP Cordova Tests[1122:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [
"INVALID",
"CDVOP",
"showCatPictures",
[
30
]
]
Je soupçonne ce peut ont quelque chose à faire avec tous les trucs que j'ai importé, donc, ici, est CDVOP.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDV.h>
#import <Cordova/CDVViewController.h>
//OP SDK
#import "OpenpeerSDK/HOPStack.h"
#import "OpenpeerSDK/HOPLogger.h"
#import "OpenpeerSDK/HOPMediaEngine.h"
#import "OpenpeerSDK/HOPCache.h"
#import "OpenpeerSDK/HOPAccount.h"
#import "OpenpeerSDK/HOPIdentity.h"
@interface CDVOP : CDVPlugin <UIWebViewDelegate> {
NSString* callbackId;
UIImageView* peerImageView;
UIImageView* selfImageView;
}
@property (nonatomic, copy) NSString* callbackId;
@property (retain, nonatomic) UIImageView *peerImageView;
@property (retain, nonatomic) UIImageView *selfImageView;
- (void) authorizeApp:(CDVInvokedUrlCommand*)command;
- (void) configureApp:(CDVInvokedUrlCommand*)command;
- (void) getAccountState:(CDVInvokedUrlCommand*)command;
- (void) startLoginProcess:(CDVInvokedUrlCommand*)command;
- (void) showCatPictures:(CDVInvokedUrlCommand*)command
@end
et c'est la partie supérieure de CDVOP.m:
#import "CDVOP.h"
@implementation CDVOP
@synthesize webView, selfImageView, peerImageView, callbackId;
-(CDVPlugin*) initWithWebView:(UIWebView*)theWebView
{
self = (CDVOP*)[super initWithWebView:theWebView];
NSLog(@">>> initializing with cordova webView <<<"); //actually this does not get called!
return self;
}
//stress test UIImageViews using a series of cat pictures
- (void)showCatPictures:(CDVInvokedUrlCommand*)command
{
//initialize and configure the image view
CGRect selfRect = CGRectMake(0, 0, 100.0, 200.0);
self.selfImageView = [[UIImageView alloc] initWithFrame:selfRect];
[self.webView.superview addSubview:self.selfImageView];
//load pictures and start animating
NSLog(@"displaying cat pictures");
selfImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.JPG"], [UIImage imageNamed:@"2.JPG"], [UIImage imageNamed:@"3.JPG"],
[UIImage imageNamed:@"4.JPG"], [UIImage imageNamed:@"5.JPG"], [UIImage imageNamed:@"6.JPG"],
[UIImage imageNamed:@"7.JPG"], [UIImage imageNamed:@"8.JPG"], nil];
selfImageView.animationDuration = 0.3;
[selfImageView startAnimating];
}
Des idées pourquoi le plugin ne semble pas être correctement initialisé et pourquoi ne puis-je pas appeler ses méthodes avec exec
?
OriginalL'auteur Aras | 2014-02-15
Vous devez vous connecter pour publier un commentaire.
Voici un petit détail sans importance j'ai oublié de mentionner dans la question. C'est ce que le
www/config.xml
dans l'exemple d'application à l'aide du plugin ressemblait. Pouvez-vous repérer le problème?Avis de l'espace dans le nom de l'application
<name>My Cordova Test</name>
. Cela semble fonctionner au premier abord, mais il met des espaces dans le nom du dossier qui sera plus tard l'hôte de votre plugin. C'est assez pour interférer avec le processus d'installation du plugin. C'est ce que j'ai fait pour résoudre le problème:MyCordovaTest
cordova platform remove ios
cordova plugin remove org.myplugin.cordova
cordova platform add ios
cordova plugin add ../my-plugin
cordova build ios
Maintenant que le plugin est bien installé et est initialisée comme prévu. Merci beaucoup pour les gentils gens dans
#phonegap
salon IRC qui m'a aidé à déboguer ce problème. J'espère que cela aide quelqu'un.OriginalL'auteur Aras