I am trying to send data from objective C to react native. I have already achieved that in other occasion with this function:
-(void)loginData:(NSString *) data
{
[self sendEventWithName:@"loginOrRegister" body:data];
}
+ (id)allocWithZone:(NSZone *)zone {
static CosmoteIdHelper *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [super allocWithZone:zone];
});
return sharedInstance;
}
I tried to do it again with function:
-(void)editProfile:(BOOL) success
{
[self sendEventWithName:@"editUserProfile" body:@{@"data": @(success)}];
}
but app crashes with "Thread 1: signal SIGABRT". I can't tell if I have forgotten something but I am pretty sure I haven't. I have tried to send a simple string but nothing.
In react-native i have an emitter like this:
const eventEmitter = new NativeEventEmitter(NativeModules.CosmoteIdHelper);
eventEmitter.addListener('editUserProfile', (event) => {
....