How to use call directory extension to identify a incoming call in my application?

前端 未结 2 1424
轮回少年
轮回少年 2020-12-01 23:34

I am working on callKit framework, I found that by the use of call directory extension, we can Identify the incoming phone number. My question how to implement a call direct

2条回答
  •  攒了一身酷
    2020-12-02 00:05

    Firstly you need to enable your CallBlocker app in App Setting for that follow this -

    Go to Settings->Phone->Call blocking & identification->Enable your App.

    After that use addIdentificationEntry for adding entry

      private func addIdentificationPhoneNumbers(to context: CXCallDirectoryExtensionContext) throws {
    
            let phoneNumbers: [CXCallDirectoryPhoneNumber] = [ 18775555555, +919899999999 ]
            let labels = [ "Telemarketer", "Local business" ]
    
            for (phoneNumber, label) in zip(phoneNumbers, labels) {
                context.addIdentificationEntry(withNextSequentialPhoneNumber: phoneNumber, label: label)
            }
        }
    

    Which is working fine in Xcode 8.x swift 3.x

提交回复
热议问题