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.

DateTimeOffset: Preserving timezone information in Azure Mobile Services (.NET backend)

For the latest project at work we decided to try out Azure Mobile Services for our backend needs. It’s a simple one-controller backend that stores objects in DocumentDb storage and passes data along. If you haven’t checked out DocumentDb yet, it’s a NoSQL database-as-a-service from Microsoft, hosted in Azure.

The development went smooth, no real trouble and Visual Studio is really an amazing environment, but we stumbled upon one issue with DateTimeOffsets and timezones. When posting to our Web API we had a DateTimeOffset that included timezone information, but when it reached the Post-method in the controller it was converted to UTC automagically. This is something we would want if the data is being stored and passed back to clients which handles timezone conversion gracefully. In our case we want to preserve the date and time as is with the correct timezone as we’re passing this data along to other services such as sending text messages using Twilio.

To disable the conversion to UTC open up the WebApiConfig class and in the Register method add these three lines:

This configures the JSON serializer to preserve the timezone information (RoundtripKind), and that we explicity set IsoDateFormat (although this is default if I recall correctly, might just omit that), and the last one tells the JSON serializer to convert dates to DateTimeOffset. If you use DateTime then ignore this setting.

With these settings in place we preserve the data as is across the wire.

Thinking it #1: The new national transportation experience

Having done my first ever professional Windows Phone 8 app, for the public transportation service here in Oslo/Akershus in Norway — RuterReise — I got to thinking of the endless possibilities of improving upon and crafting new experiences.

RuterReise, the app we released three months ago on Android and Windows Phone is an app to help you plan your travels, see when the next subway that you want to get on departures and see that you really should have taken that left turn instead of heading straight in our detailed map view of a planned trip. Head on past the break and lets discuss what the future might bring for you as a user, developer and a passenger!