我如何在目录中添加联系人,我在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