iOS 10中的呼叫拦截功能

问题描述:

我正在尝试整合CallDirectory Extension来阻止某些来电。但是应用程序甚至没有意识到为阻止提供的数字。有没有人成功做到这一点? 你可以看到,我已经使用的格式..iOS 10中的呼叫拦截功能

private func addIdentificationPhoneNumbers(to context: CXCallDirectoryExtensionContext) throws { 

      let phoneNumbers: [CXCallDirectoryPhoneNumber] = [ 18775555555, 18885555555,+91949520] 
      let labels = [ "Telemarketer", "Local business","myPhone"] 

      for (phoneNumber, label) in zip(phoneNumbers, labels) { 
       context.addIdentificationEntry(withNextSequentialPhoneNumber: phoneNumber, label: label) 
      } 
     } 

而且,我提到本作的开发。 http://iphoneramble.blogspot.in/2016/07/ios-10-callkit-directory-extension.html

测试设备& IOS版本 - 的iPhone 5S,iOS的10.1

+0

请分享一些代码。 – Poles

电话号码的数组必须是Int64类型的排序列表。从最小到最大。该列表将被拒绝,否则将出现“输入无序”错误。

Atlast,我已经有了呼叫阻塞的解决方案。我还没有办法检查呼叫阻止代码是否正常工作。以下是我为使其工作而做的一些事情。

  • 检查,如果您的应用程序在64位的iOS设备上运行 (iPhone 5S或更高版本的设备)
  • 在数字升序
  • 国家代码添加到每个数字
  • 一个添加号码用于添加用于阻止的移动号码的示例代码在下面给出

    let phoneNumber:CXCallDirectoryPhoneNumber = CXCallDirectoryPhoneNumber(“+ 9194 ******”)! context.addBlockingEntry(withNextSequentialPhoneNumber:phoneNumber的)

  • 检查您的申请已获准黑调用 (设置 - >电话 - >呼叫阻止&识别 - >检查您的应用程序允许阻止呼叫)

  • 您还可以通过把这个下面的代码在你的viewController检查enabledStatus

CXCallDirectoryManager.sharedInstance.get EnabledStatusForExtension(withIdentifier: “bundleIdentifierOfYourExtension”,completionHandler: {(状态,错误) - >空隙中 如果让误差= {错误打印 (error.localizedDescription) } })

  • 另外,以下代码添加到的viewController

CXCallDirectoryManager.sharedInstance.reloadExtension(withIdentifier: “bundleIdentifierOfYourExtension”,completionHandler:{(error) - >如果发生error = error { print(错误),则在 中失效。localizedDescription) }} )

你会发现这些网址的发展很有帮助。 http://iphoneramble.blogspot.in/2016/07/ios-10-callkit-directory-extension.html

https://translate.google.com/translate?hl=en&sl=zh-CN&u=http://colin1994.github.io/2016/06/17/Call-Directory-Extension-Study/&prev=search

请请让我知道,如果你已经得到改进的方法和更正。 感谢和快乐的编码。

+0

从数字上升的顺序? –

+0

呼叫目录分机号码不会给任何号码 –

+0

也不会阻止呼叫帮助我 –