I am looking for a way to get CTCallCenter Events on an enterprise app while it is in the background. I came across the suggested solution by OhadM on this post: How to get a call event using CTCallCenter:setCallEventHandler: that occurred while the app was suspended?, but I can't get it to work with the app in the background.
I created a new single view app, added a callCenter property on the appDelegate and set the callEventHandler as shown in the post and listed below. I also added the Voice over IP and Background fetch Background Modes Capabilities as described.
Is there any other settings or code not mentioned in the solution that may help? I am using iOS 9.3.1 and Xcode 7.3.1.
[self.callCenter setCallEventHandler:^(CTCall *call)
{
NSLog(@"Event handler called");
if ([call.callState isEqualToString: CTCallStateConnected])
{
NSLog(@"Connected");
}
else if ([call.callState isEqualToString: CTCallStateDialing])
{
NSLog(@"Dialing");
}
else if ([call.callState isEqualToString: CTCallStateDisconnected])
{
NSLog(@"Disconnected");
} else if ([call.callState isEqualToString: CTCallStateIncoming])
{
NSLog(@"Incomming");
}
}];