Xamarin: You must explicitly unsubscribe from NSNotifications if IDisposable

In Xamarin, if you observe / subscribe to a particularly-named NSNotification in an object that is IDisposable (this includes any class descended from NSObject!), you MUST explicitly unsubscribe from it in your Dispose handler, or you will get a segfault (the system will attempt to call a method at a memory …

more ...

3D Buildings Not Showing in Your iOS App?

I totally forgot a frustrating detail about showing 3D buildings in iOS 7 : it doesn't work in the simulator! You have to use a hardware device!

more ...

UIWebView.SetCenterCoordinate is asynchronous

You cannot rely on the value of UIWebView.CenterCoordinate after setting UIWebView.SetCenterCoordinate and I don't know of any event that is raised when it is finally set. To be more specific:

var map = new MKMapView();

var ctr = new CLLocationCoordinate2D(37.8, -122.4);
map.SetCenterCoordinate(ctr, false);
map.SetRegion …
more ...

Cross-Platform Mobile Architectural Patterns

This post contains links and references to subjects discussed in my MonkeySpace 2013 talk.

Naturally, the talk was grounded in Xamarin Studio.

Xamarin's Field Service App is a reference implementation for cross-platform MVVM.

The Xamarin DCI example source code can be found here.

Essential books on software-architectural patterns:

more ...

Accessing the Android Barometer using Xamarin.Android

Easily:

< ![CDATA[
[Activity (Label = "HelloBarometer", MainLauncher = true)]
public class Activity1 : Activity, ISensorEventListener
{
    TextView mainLabel;  

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);
        //Detect the barometer
        var sm = (SensorManager) this.GetSystemService(Context.SensorService);
        var barry = sm.GetDefaultSensor(SensorType …
more ...