我正在为iOS开发自定义电话拨号器应用程序。我的想法是通过能够使用呼叫目录分机阻止无来电显示电话呼叫来创造良好的体验。目前在iOS上,除了打开"请勿删除"模式外,无法阻止未知呼叫者。
有没有办法以某种方式以编程方式识别和阻止没有电话号码标识的呼叫者,或者阻止显示"无来电显示"的标签?
到目前为止,我已经尝试过CallDirectoryHandler
private func addAllBlockingPhoneNumbers(to context: CXCallDirectoryExtensionContext) {
/**
Retrieve all phone numbers to block from data store. For optimal performance and memory usage
when there are many phone numbers, consider only loading a subset of numbers at a given time
and using autorelease pool(s) to release objects allocated during each batch of numbers
which are loaded.
Numbers must be provided in numerically ascending order.
*/
let unknownCaller = CXCallDirectoryPhoneNumber()
let unknownCaller1: CXCallDirectoryPhoneNumber = 0
let unknownCaller2: CXCallDirectoryPhoneNumber = 00000000
let caller381X: CXCallDirectoryPhoneNumber = 38161XXXXXXX
context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller)
context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller1)
context.addBlockingEntry(withNextSequentialPhoneNumber: unknownCaller2)
context.addBlockingEntry(withNextSequentialPhoneNumber: caller38161X)
}
到目前为止,我已经能够阻止这个常规电话号码 38161XXXXXXXXXXX,但是,如果同一个号码通过隐藏前缀 #31# 来呼叫,则呼叫将通过。
有谁知道这是否可能,有没有办法识别和阻止无来电显示?
不可以,CallKit 呼叫阻止扩展必须指定要阻止的号码。 不能指定要阻止的"无号码"。