Xamarin: Using the ABPeoplePickerNavigationController in iOS 8

Hi guys, I thought I would post a quick snippet demonstrating one way of dealing with the ABPeoplePickerNavigationController in iOS 8. If you have noticed that the SelectPerson event is not firing anymore then you are not alone.

The new way of dealing with the controller is using a seperate delegate class and assigning it to the ABPeoplePickerNavigationController using the Delegate property. This can give a nice seperation of concerns but can quickly get messy, so I created a new basic class that creates a layer of abstraction and implements the async/await pattern in doing so as well.

Please feel free to comment, edit, improve and use it as you please.

AsyncPeoplePicker

As JoeAshbrook pointed out, this code won’t run well when doing so in another thread. He posted the following adjustment:

 

Usage

Hopefully this can help you in your ways of dealing with the ABPeoplePickerNavigationController.

  • servitola

    Thank you very much. It was very helpful for me.

    There is a mistake in first codeblock (line 21): PickerDelegate eventHandler = null should be PickerDelegate.SelectPersonEventHandler eventHandler = null;