문제

Does anyone know the compiler directive I'd use in MonoTouch to see if I'm running in the iPhone simulator? Can't find any info anywhere.

Thanks!

도움이 되었습니까?

해결책

There is no compiler directive (conditional compilation symbol) to determine if you're running in the iPhone simulator or on a device.

You can however determine 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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top