MonoTouch Compiler Directive for iPhone Simulator

Does anyone know a compiler directive that I would use in MonoTouch to find out if I work in an iPhone simulator? Unable to find any information anywhere.

Thanks!

+8
c # compiler-directives
source share
1 answer

There is no compiler directive (a conditional compilation symbol) to determine if you are working in an iPhone simulator or on a device.

However, you can define it at runtime using this code:

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

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

+11
source share

All Articles