Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No visible @interface for 'CDVPluginResult' declares the selector 'setKeepCallbackAsBool:' #6

Open
niranjan-b-prajapati opened this issue Nov 3, 2016 · 0 comments

Comments

@niranjan-b-prajapati
Copy link

niranjan-b-prajapati commented Nov 3, 2016

Hi,

I have one custom cordova plugin made by client developers, which i need to be integrated into my react-native application for IOS.

I have used your component and also added the cordova class in my project, but i get the above mentioned error i.e. No visible @interface for 'CDVPluginResult' declares the selector 'setKeepCallbackAsBool:'

Following is the code of cordova class .m file:

#import "CordovaHaxeBridge.h"
#import "mmsne_api.h"

NSString * callbackId;
CordovaHaxeBridge * instance;

void on_event(NSString * name, NSString * data) {
    //NSLog(@"Event %@ : %@",name,data);
    if (instance && callbackId)
    @autoreleasepool {
        NSDictionary * evt = [NSDictionary dictionaryWithObjectsAndKeys:name,@"name",data,@"data", nil];
        CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
                                                messageAsDictionary:evt];
       [result setKeepCallbackAsBool:YES];
        [instance.commandDelegate sendPluginResult:result callbackId: callbackId];
    }
    else
      NSLog(@"EVENT NOT PASSED ON: %@",name);

    //delete name, data;
}

@implementation CordovaHaxeBridge {}
RCT_EXPORT_MODULE(RCTCordovaHaxeBridge)
RCT_EXPORT_CORDOVA_METHOD(call);

- (void)pluginInitialize {
    NSLog(@"Initing MMSNE Cordova plugin");
    init_mms(&on_event);
    instance = self;
}

- (void)eventer:(CDVInvokedUrlCommand *)command {
    NSLog(@"Eventer initialized");
    callbackId = command.callbackId;
}


- (void)call:(CDVInvokedUrlCommand *)command {
    NSString * fname = [command.arguments objectAtIndex: 0];
    NSString * args = [command.arguments objectAtIndex: 1];
    //NSLog(@"OC PRE Call %@: %@",fname,args);
    call_haxe(fname,args);
    //NSLog(@"OC POST Call %@",fname);

    //delete fname, args;

    CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

@end

I am getting error on the following line:

[result setKeepCallbackAsBool:YES];

Following is the code of .h file :

#import "CDVPlugin.h"
@interface CordovaHaxeBridge : CDVPlugin

- (void)call:(CDVInvokedUrlCommand*)command;
- (void)eventer:(CDVInvokedUrlCommand*)command;

@end

I have compared the code from the following url:
https:/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVPluginResult.m

there are some functions which are not included in your class can you please explain the reason for same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant