Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call blocking feature in iOS 10

I am trying to integrate CallDirectory Extension for blocking some incoming call. But application is not even recognising the numbers provided for blocking. Is there anyone who have succeeded in doing this ?? You can see the format that i have used..

   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)
            }
        }

And , i referred this for development. http://iphoneramble.blogspot.in/2016/07/ios-10-callkit-directory-extension.html

Testing Device & iOS Version - iphone 5s ,iOS 10.1

like image 347
good4pc Avatar asked Nov 18 '16 09:11

good4pc


People also ask

How do you block a number on iOS 10?

To do that, go to the “Recents” tab in the Phone app and tap the “i” icon next to the phone number or the person's name. From the bottom here, tap the “Block this caller” button. Then select “Block Contact” to confirm.

Why is call blocking not showing on iPhone?

Restart your device. Then proceed to iPhone Settings > Phone > Call Blocking & Identification > Turn ON Productive.

Where is call blocking in settings on iPhone?

Go to Settings > Phone. Tap Call Blocking & Identification. Under Allow These Apps To Block Calls And Provide Caller ID, turn the app on or off.


1 Answers

Atlast , I have got the solution for call blocking. I haven't had a way to check if the call blocking code is working or not. Here are some of the things that i have done for making it work.

  • Check if your application is running in 64 bit iOS device (iphone 5s or greater devices)
  • Adding the numbers in numerically ascending order
  • Add country code to every number
  • A sample code for adding mobile numbers for blocking is given below

    let phoneNumber : CXCallDirectoryPhoneNumber = CXCallDirectoryPhoneNumber("+9194******")! context.addBlockingEntry(withNextSequentialPhoneNumber: phoneNumber)

  • Check your application has given permission to black calls (setting -> phone -> call Blocking & identification -> Check your app is allowed to block calls)

  • You can also check the enabledStatus by putting this below code in your viewController

CXCallDirectoryManager.sharedInstance.getEnabledStatusForExtension(withIdentifier: "bundleIdentifierOfYourExtension", completionHandler: {(status, error) -> Void in if let error = error { print(error.localizedDescription) } })

  • Also , add following code to viewController

CXCallDirectoryManager.sharedInstance.reloadExtension(withIdentifier: “bundleIdentifierOfYourExtension”, completionHandler: { (error) -> Void in if let error = error { print(error.localizedDescription) } })

You will find these url's helpful for the development. 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

Kindly please let me know if you have got improved methods and corrections. Thanks and happy coding.

like image 146
good4pc Avatar answered Sep 27 '22 22:09

good4pc