呼叫目录分机 CallKit 无法识别超过 9 位的号码

Call Directory Extension CallKit does't recognize numbers with more than 9 digits

我正在使用 CallKit 开发一个带有 Call Directory Extension 的应用程序。我已经遵循了这个 tutorial 并且我目前正在测试识别用户在他的联系人中没有的号码并显示我的应用程序中的 ID 的能力,但是尽管可以完美地处理 1 到 9 的数字数字,例如 123456,当我设置 10 位或更多数字时,iOs 无法识别该数字。 google 一天半后,我没有找到任何相关信息。如果有人可以帮助我,我将不胜感激。提前致谢。

识别phone个号码的设置方法:

private func addAllIdentificationPhoneNumbers(to context: CXCallDirectoryExtensionContext) {
        // Retrieve phone numbers to identify and their identification labels 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 allPhoneNumbers: [CXCallDirectoryPhoneNumber] = [ 123456789, 1_888_555_5555 ]
        let labels = [ "ID test", "Local business" ]

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

使用此代码,当我模拟号码为 123456789 的呼叫时,iOS 显示标签 "ID test",这是正确的,但如果我在末尾添加任何数字,例如 0: 1234567890, iOS 模拟通话时不显示任何内容。不知道是不是漏了什么

好吧,经过一系列测试我可以让它工作。重点是 phone 必须包含完整的国家代码和区号 。因此,例如 00_52_55_4567_8932 877 或 +52_55_4567_8932 都可以。但是 55_4567_8932 和 4567_8932 将不起作用。我希望这可以在将来帮助其他人。谢谢大家!