Xamarin: Reload an iOS CallKit call directory extension from the app

I you want to make a call directory extension for iOS, for identifying or blocking certain phone numbers, you need a way to reload the extension every time you want to add or remove from the list of phone numbers you are blocking.

To reload the extension, you can either get your users to open their phone’s settings and disable the extension and re-enable it or you can reload it programmatically from your app.

To reload the extension manually, follow this procedure:

  1. Open the iPhone’s settings
  2. Go to “Phone”
  3. Go to “Identify phone numbers”
  4. Switch your extension off, then on again

To reload the extension programmatically from your app, use this code:

Here is Apple’s documentation for the error codes :
https://developer.apple.com/reference/callkit/cxerrorcodecalldirectorymanagererror.code/

The most common one I have come across is 6, Extension Disabled.

How to create an iOS call directory extension in Xamarin for blocking thousands of phone numbers

A call directory extension is used to block or identify phone numbers on an iPhone, phone numbers the user don’t have in their contact list.

TL;DR: Because iOS app extensions have very limited resources, it is difficult to load many thousand phone numbers into the call directory without the extension crashing. This is my attempt to get around this issue.

Continue reading “How to create an iOS call directory extension in Xamarin for blocking thousands of phone numbers”