Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CallKit com.apple.CallKit.error.calldirectorymanager error 1

Tags:

ios

swift

callkit

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.

like image 916
SShah Avatar asked Oct 23 '25 18:10

SShah


1 Answers

You are using app group for the reloadExtension.

Use your bundle identifier of your callkit extension.

like image 102
Sunny Shah Avatar answered Oct 26 '25 07:10

Sunny Shah