react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

NSInternalInconsistencyException: Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

Open rcidt opened this issue 2 years ago • 3 comments

Bug report

  • [X] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [ ] Android

  • [X] iOS

Description

We are seeing some Crashlytic reports like this:

Fatal Exception: NSInternalInconsistencyException Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

(full log below)

Here is the pushRegistry block in our AppDelegate.m

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
  NSString *uuid = @"unknown";
  NSString *handle = @"unknown";
  NSString *callerName = @"unknown";
  NSDictionary *extra;
  
  @try {
    [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
    
    uuid = [[NSUUID UUID] UUIDString].lowercaseString;
    NSString *ani = [payload.dictionaryPayload valueForKeyPath:@"data.ani"];
    NSString *name = [payload.dictionaryPayload valueForKeyPath:@"data.callerName"];
    
    if (ani && [ani isKindOfClass:[NSString class]]) {
      handle = ani;
    }
    callerName = handle;
    if (name && [name isKindOfClass:[NSString class]]) {
      callerName = name;
    }
    extra = [payload.dictionaryPayload valueForKeyPath:@"data"];
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
    [dateFormatter setLocale:enUSPOSIXLocale];
    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
    [dateFormatter setCalendar:[NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]];

    NSDate *now = [NSDate date];
    NSString *iso8601String = [dateFormatter stringFromDate:now];
    [extra setValue:iso8601String forKey:@"notificationTime"];
  }
  @catch (NSException *exception) {}
  
  [RNCallKeep reportNewIncomingCall: uuid
                               handle: handle
                           handleType: @"number"
                             hasVideo: NO
                  localizedCallerName: callerName
                      supportsHolding: YES
                         supportsDTMF: YES
                     supportsGrouping: YES
                   supportsUngrouping: NO
                          fromPushKit: YES
                              payload: extra
                withCompletionHandler: completion];
}

Steps to Reproduce

We have not been able to reproduce. These reports are coming from the wild, and they seem to be very sparse.

Versions

- Callkeep: 4.3.6
- React Native: 0.66.3
- iOS: 16
- Android: N/A
- Phone model: 

Logs

Fatal Exception: NSInternalInconsistencyException
Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9e48 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  Foundation                     0x54594c _userInfoForFileAndLine
3  PushKit                        0x473c -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes]
4  libdispatch.dylib              0x3fdc _dispatch_client_callout
5  libdispatch.dylib              0x13574 _dispatch_lane_barrier_sync_invoke_and_complete
6  PushKit                        0x3a54 __73-[PKPushRegistry voipPayloadReceived:mustPostCall:withCompletionHandler:]_block_invoke
7  libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
8  libdispatch.dylib              0x3fdc _dispatch_client_callout
9  libdispatch.dylib              0x127f4 _dispatch_main_queue_drain
10 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF
11 CoreFoundation                 0x9a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12 CoreFoundation                 0x7c03c __CFRunLoopRun
13 CoreFoundation                 0x80ec0 CFRunLoopRunSpecific
14 GraphicsServices               0x1368 GSEventRunModal
15 UIKitCore                      0x3a186c -[UIApplication _run]
16 UIKitCore                      0x3a14d0 UIApplicationMain
17 net2phone                      0x5b40 main + 7 (main.m:7)
18 ???                            0x1bed76960 (Missing)

rcidt avatar Feb 13 '23 16:02 rcidt

you got the solution??

neetable-punitha avatar Oct 06 '23 04:10 neetable-punitha

@neetable-punitha no

rcidt avatar Nov 29 '23 18:11 rcidt