I'm trying to determine if the app is running in the simulator or on the hardware (Apple iPhone) device.
Various answers are all suggesting that I do the following:
bool isSimulator = MonoTouch.ObjCRuntime.Runtime.Arch ==
MonoTouch.ObjCRuntime.Arch.SIMULATOR;
which I've added to my iOS app AppDelegate.cs
file. But it does compile - I'm missing a namespace or assembly.
Here's a pic of the FULL method (with the colour coding showing it cannot find the static property):
using ObjCRuntime;
bool isSimulator = Runtime.Arch == Arch.SIMULATOR;
FYI: The MonoTouch
namespace is deprecated (~2012) and has been broken up into multiple namespaces within the "Xamarin.iOS" product.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With