-->

CallKit - Call log in recent calls does not show n

2019-02-11 08:02发布

问题:

I am using CallKit in a VOIP application. Everything works fine except in the recent call list after an outgoing call is placed, it shows only the number, even though the number is saved in the phonebook. for example, there is a contact named 'John' in the phonebook. now if an outgoing call is placed from the app, in the recent log it only shows the number. this is what i did.

NSUUID *callUUID = [NSUUID UUID];
CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:number];
CXStartCallAction *action = [[CXStartCallAction alloc] initWithCallUUID:callUUID handle:handle];
action.contactIdentifier = identifier; //identifier of that contact
[self.callController requestTransaction:[CXTransaction transactionWithActions:@[action]] completion:completion];

回答1:

The problem is that you don't tell the provider the name when start a outgoing call, you can solve it adding in performStartCallAction the next code:

CXCallUpdate *update = [[CXCallUpdate alloc] init];
[update setRemoteHandle:[[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:number]];
[update setLocalizedCallerName:name];

[provider reportCallWithUUID:uuid updated:update];

With this code I solved the same problem and now it show the name.