adnako
adnako

Reputation: 1275

iOS kills CallKit VoIP app working in background in one minute

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.

Upvotes: 2

Views: 3689

Answers (5)

Irfan Khatik
Irfan Khatik

Reputation: 146

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

Upvotes: 2

Jeyhey
Jeyhey

Reputation: 510

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.

Upvotes: 0

Hasya
Hasya

Reputation: 9898

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.

Upvotes: 1

adnako
adnako

Reputation: 1275

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.

Upvotes: 0

zmarties
zmarties

Reputation: 4869

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

Upvotes: 1

Related Questions