Hi everyone,
I'm develping an app that manage some phone numbers and when I try to use CallKit Directory Extension for identify the phone numbers of who call don't work for me.
I have the data in the ViewController and I pass it to Extension with App Groups. This works fine, but the problem is next.
I get properly the data in a Dictionary with this format: Dictionary: [String:String]. First key is the phone and value is the label [phoneNumber:Label]
Then I create a sorted array with all phone numbers: phones = Dictionary.keys.sorted(). (Works fine)
Then I create an array with labels:
for phone in Dictionary {
labels.append(Dictionary[phone]
}
This works too fine.
Finally I use the for repeat that Apple have in the example for add it to context:
for (phoneNumber, label) in zip(phones, labels) {
context.addIdentificationEntry(withNextSequentialPhoneNumber: CXCallDirectoryPhoneNumber("34"+phoneNumber)!, label: label)
}
(the "34" that I add is the country code of Spain, I try too without it)
I run the app and the extension in my iPhone and the extension is activated correctly, but if a phone that I have in my app (and not in Contacts) call me, iOS only say "Spain", but not <App> Caller ID: <Label>
How can I solve it?
Thanks so much in advance!
(I test in a phone with iOS 11.2 beta and in other iPhone without beta)