Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CallKit is not showing Incoming UI when Device is Locked

I am developing a voip app, which uses Callkit to show System UI for incoming calls.

To test the incoming call, I triggered it from my app like below

let callHandle = CXHandle(type: .phoneNumber, value: "+9197xxxxxxxx")
let callUpdate = CXCallUpdate()
callUpdate.remoteHandle = callHandle
callUpdate.supportsDTMF = true
callUpdate.supportsHolding = true
callUpdate.supportsGrouping = false
callUpdate.supportsUngrouping = false
callUpdate.hasVideo = false
UIApplication.shared.beginBackgroundTask {
    print("Error")
}
DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
    self.callKitProvider.reportNewIncomingCall(with: UUID(), update: callUpdate) { (error) in
        print(error)
    }
}

which works fine when app is in foreground, but when I put the device in locked state it throws error as "Error Domain=com.apple.CallKit.error.incomingcall Code=3 "(null)""

Please help. Thanks in Adavance!

like image 341
Kishore Kumar Elanchezhiyan Avatar asked Oct 16 '25 14:10

Kishore Kumar Elanchezhiyan


2 Answers

DND was the problem as @AntonioM suggested in the comments, Switching it off works fine.

like image 157
Kishore Kumar Elanchezhiyan Avatar answered Oct 18 '25 06:10

Kishore Kumar Elanchezhiyan


Have you set the info.plist? Required background modes -> 'App provides Voice over IP services' requested.

like image 37
oldold Avatar answered Oct 18 '25 08:10

oldold