MonoTouch runtime test to make sure it works in the simulator

Probably very simple, but I can’t find the answer - how can I perform a run-time check (using MonoTouch) to make sure that I am in the iPhone simulator (or not)?

thank

+5
source share
1 answer

You can do it as follows:

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

+10
source

All Articles