我已经在适用于iOS的phoneGap中制作了一个自定义演示插件,但它没有被调用。
这是我到目前为止所做的:
adobeCustom.js
var cordova = require('cordova');
function AdobePlugin() {}
AdobePlugin.prototype.editImage = function(imageUri, successCallback, errorCallback) {
cordova.exec(successCallback, errorCallback, 'AdobePlugin', 'editImage', [imageUri]);
}
};
cordova.addConstructor(function() {
if(!window.plugins) window.plugins = {};
window.plugins.adobePlugin = new AdobePlugin();
});
PGAdobeCreative.m //插件文件
#import <AdobeCreativeSDKFoundation/AdobeCreativeSDKFoundation.h>
#import <AdobeCreativeSDKImage/AdobeCreativeSDKImage.h>
#import <AdobeCreativeSDKImage/AdobeUXImageEditorViewController.h>
#import <AdobeCreativeSDKFoundation/AdobeUXAuthManager.h>
#import "PGAdobeCreativeSDKFoundation.h"
#import "NSObject+PropertiesAsDictionary.h"
#import "NSArray+ItemAsDictionary.h"
@interface PGAdobeCreativeSDKFoundation () <AdobeUXImageEditorViewControllerDelegate>
@end
@implementation PGAdobeCreativeSDKFoundation
#define ADOBE_CSDK_CLIENT_ID @"5587f31263dc4f3id"
#define ADOBE_CSDK_CLIENT_SECRET @"81292c83-eec7-key"
- (void)editImage:(CDVInvokedUrlCommand *)command
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Image test"
message:@"called"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
@end
的index.html:
<script type="text/javascript" src="js/adobeCustom.js"></script>
<button id='getFileContents' onclick="window.plugins.adobePlugin.editImage('imagename')">Click here</button>
我哪里出错了?我该如何解决这个问题?