PhoneGap - JavaScriptからネイティブIOS機能を呼び出すことができません
-
14-11-2019 - |
質問
私はiOSとPhoneGap Newbieですので、私と一緒に耐えてください。Index.html - に次のコードがあります。
function onDeviceReady()
{
// do your thing!
//navigator.notification.alert("PhoneGap is working");
MyClass.nativeFunction(
["HelloWorld"] ,
function(result) {
alert("Success : \r\n"+result);
},
function(error) {
alert("Error : \r\n"+error);
}
);
}
.
次のようなmyclass.jsというファイルがあります -
var MyClass = {
nativeFunction: function(types, success, fail) {
return PhoneGap.exec(success, fail, "MyClass", "print", types);
}
}
.
私はMyClassと呼ばれるClassと呼ばれるClassを持っています。しかし、それは決して到達しません。その理由は何ですか?
更新:My .hクラス
#import <Foundation/Foundation.h>
#import <PhoneGap/PGPlugin.h>
@interface MyClass : PGPlugin {
NSString* callbackID;
}
@property (nonatomic, copy) NSString* callbackID;
//Instance Method
- (void) print:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
@end
. 解決
Have you added your plugin to your PhoneGap.plist file?
If so, what key/value did you use? It looks to me like it should be MyClass/MyClass
所属していません StackOverflow