voice-quickstart-ios: iOS 13 App built on Xcode 11 Crashes when receiving call if the app is on background or killed

Description

I have a react-native application that use a home built component to handle Twilio communication. We have upgraded to latest 5.x twilio iOS SDK and latest Android SDK. On Android it works great. On iOS the calls work perfect when the app is in foreground but it fails when the app is killed and the phone locked. I followed all the issues and the migration guides to no avail. I’m sure there’s something wrong in the code as I’m experiencing what is described in issue #251 but I’m not sure what’s wrong. When the phone is killed pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler is never called and then I get an error saying Killing VoIP app <private> because it failed to post an incoming call in time.

Steps to Reproduce

  1. Launch application in iphone with iOS 13.x and log in. Make sure Twilio is registered
  2. Kill the app and lock the phone
  3. Call the locked phone.
  4. Application starts in XCode Debug, but is killed with Killing VoIP app <private> because it failed to post an incoming call in time. Error.

Expected Behavior

That I receive a call

Actual Behavior

Nothing happens.

Reproduces How Often

Always

Versions

Voice iOS SDK

5.1.1

Xcode

11.3.1

iOS Version

13.3.1

iOS Device

iPhone 6s Plus

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 55 (26 by maintainers)

Most upvoted comments

Do this first, Important! Screenshot 2021-03-26 at 10 12 06 AM

Screenshot 2021-03-26 at 10 15 36 AM

Add below code is inside : func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void)

Screenshot 2021-03-26 at 10 13 45 AM

Use completion() in main thread.

  1. PKRegistryDelegate needs to be registered during the launch or quickly as possible else you never get the Push.
  2. Call provider.reportNewIncomingCall inside didReceiveIncomingPushWith
  3. Use completion() in main thread.

These steps solved my problem.

@bchen-twilio thanks for your quick reply.

  1. CA41c30b941d1f21e77192a7d8a894d6dc
  2. CA498cb86bab53ca2b7fa6b275d386aeb2
  3. CA257c4f105547e0ba64bf5183456086bc

Please let me know if you need any further information.

Sure, I’ll do that and I will also use the same library in a new application without any other library to see if it works. Thanks @bchen-twilio