Skip to content

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

@niranjan-b-prajapati

Description

@niranjan-b-prajapati

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://github.com/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions