MonoTouch runtime test to see if it's running in the simulator

c#, simulator, xamarin.ios

Solution

You can do it like this:

using MonoTouch.ObjCRuntime;
static bool InSimulator ()
{
    return Runtime.Arch == Arch.SIMULATOR;
}

This is from here: http://docs.xamarin.com/ios/recipes/General/Projects/Environment_Checks

Problem

Probably really simple, but I can't find an answer - how can I do a check at runtime (using MonoTouch) to make sure I'm in the iPhone simulator (or not) ? Thanks

Original source