1
votes

I have a VoIP app, it uses CallKit and PushKit. When app is closed and iOS receives a push notification, the app has been woken up in background mode, it answers on call through CallKit and everything works fine, approximately for 50 seconds. After that iOS kills app with signal 9. I selected next background modes: audio and voip, but iOS wants something more to continue infinite background task.

What I forgot to do to prevent killing my app by the system?

P.S. When I call to my app when it's in foreground a call lasts well for hours. Then it's not a memory pressure is the reason for app killing.

5

5 Answers

2
votes

After creating VoIP certificate on developer account, In background mode enable below fields

1] Audio and Airplay
2] Voice over IP
3] Background fetch
4] Remote notifications
1
votes

When woken up, you need to call [UIApplication beginBackgroundTaskWithExpirationHandler]

1
votes

I hope you have given permission like below screens.

enter image description here

enter image description here

iOS kills app with signal 9, that happens due to memory leak or low memory usage.

You can check with instrumentation.

0
votes

I've found out, reading debug console, that my app utilizes more than 90% CPU answering to a call in background. This is a reason why iOS kills my app.

0
votes

Are you using the pre build of pristine? That build has a WebRTC bug that was fixed later. It causes too high CPU usage on voice-only calls (issue5506). Switch to the WebRTC pod to fix this (https://cocoapods.org/pods/WebRTC).

Moving to the WebRTC pod will take a bit more time than changing the dependency as the API was changed a bit. It wasn't changed much though, so it is doable in a day or two. Switching to the official pod is in any case the way to go as the build from pristine is no longer maintained.