'CallKit com.apple.CallKit.error.calldirectorymanager error 1
I am using callkit to identify phone number.
It gives me error : The operation couldn’t be completed. (com.apple.CallKit.error.calldirectorymanager error 1.)
override func viewDidLoad() {
super.viewDidLoad()
let numbers = ["94XXXXXXX"]
let labels = ["TestUser"]
writeFileForCallDirectory(numbers: numbers, labels: labels)
// Do any additional setup after loading the view, typically from a nib.
}
fileprivate func writeFileForCallDirectory(numbers: [String], labels: [String]) {
guard let fileUrl = FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: "group.com.CallKit.CallBlock")?
.appendingPathComponent("contacts") else { return }
var string = ""
for (number, label) in zip(numbers, labels) {
string += "\(number),\(label)\n"
}
try? string.write(to: fileUrl, atomically: true, encoding: .utf8)
//CXCallDirectoryManager.sharedInstance.reloadExtension(withIdentifier: "group.com.CallKit.CallBlock")
CXCallDirectoryManager.sharedInstance.reloadExtension(withIdentifier: "group.com.CallKit.CallBlock", completionHandler: { (error) -> Void in
if let error = error {
print(error.localizedDescription)
}
})
}
App group is enable to share data between app and extension but I don't know what I am doing wrong.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
