react-native-webrtc / react-native-voip-push-notification

React Native VoIP Push Notification - Currently iOS only
ISC License
213 stars 83 forks source link

Crash when I receive voip push #70

Closed darknessproduction closed 3 years ago

darknessproduction commented 3 years ago

Hi, guys. Many thanks to @zxcpoiu. You're making the greatest work. I get this error when I receive voip push. I'm using voip certificate to send voip pushes. I send this with push if it makes sense:

aps: {

alert => 'test'
sound => 'default'
content-available => 1
apns-push-type => voip
apns-priority => 10

}
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil'
*** First throw call stack:
(0x196c7d114 0x1aa4a3cb4 0x196ce7398 0x196cf27b0 0x196b6db9c 0x104b9ae90 0x1049309f8 0x1bdb41590 0x10759bdb8 0x10759d5fc 0x1075aba6c 0x196bfcc30 0x196bf70e8 0x196bf6200 0x1accf1598 0x1994bc004 0x1994c15d8 0x104930cc0 0x1968d5598)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil'
terminating with uncaught exception of type NSException
(lldb) 
darknessproduction commented 3 years ago

Okay I figured it. Can you change documentation. Because I lost some time to fix it. Replace this

  NSString *uuid = payload.dictionaryPayload[@"uuid"];
  NSString *callerName = [NSString stringWithFormat:@"%@ (Connecting...)", payload.dictionaryPayload[@"callerName"]];
  NSString *handle = payload.dictionaryPayload[@"handle"];

with

   NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
   NSString *callerName = @"caller name here";
   NSString *handle = @"caller number here";
darknessproduction commented 3 years ago

Then you can close this. Thank you for your genius work anyway :)

zxcpoiu commented 3 years ago

I will add the memo, cheers

Asher978 commented 3 years ago

Okay I figured it. Can you change documentation. Because I lost some time to fix it. Replace this

  NSString *uuid = payload.dictionaryPayload[@"uuid"];
  NSString *callerName = [NSString stringWithFormat:@"%@ (Connecting...)", payload.dictionaryPayload[@"callerName"]];
  NSString *handle = payload.dictionaryPayload[@"handle"];

with

   NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
   NSString *callerName = @"caller name here";
   NSString *handle = @"caller number here";

this is so crucial to be changed in the docs. I spent hours troubleshooting.

@darknessproduction thank you for sharing the comment here ...

Romick2005 commented 3 years ago

But what was the problem? Have you send callerName, uuid, phoneNumber in voip notification body? For me it works as it is.

Dat-Mobile commented 1 year ago

make sure callerName field inside payload.dictionaryPayload[@"callerName"] is provided

otherwise it will crash