我如何在目录中添加联系人,我在 CallDirectoryHander 类中添加了联系人,它工作正常,但是当我想从视图控制器页面添加电话号码动态时,不要阻止呼叫。
我曾尝试使用以下代码在视图控制器的目录中添加联系人
let cnctNumber = phoneNumber.text
let contentIs = CXCallDirectoryExtensionContext()
//self.addBlockingPhoneNumbers(to: contentIs )
numberContact = countryCode + self.phoneNumber.text!
let numberFromString = Int64(numberContact)
let phoneNumber : CXCallDirectoryPhoneNumber = CXCallDirectoryPhoneNumber(numberFromString!)
contentIs.addBlockingEntry(withNextSequentialPhoneNumber: phoneNumber)
contentIs.completeRequest()
reloadDirectory()//To reload Directory