Som*_*Man 8 c# compiler-directives xamarin.ios
有没有人知道我在MonoTouch中使用的编译器指令,看看我是否在iPhone模拟器中运行?无法在任何地方找到任何信息.
谢谢!
Rol*_*nge 11
没有编译器指令(条件编译符号)来确定您是在iPhone模拟器中运行还是在设备上运行.
但是,您可以使用以下代码在运行时确定它:
using ObjCRuntime;
static bool InSimulator ()
{
return Runtime.Arch == Arch.SIMULATOR;
}
Run Code Online (Sandbox Code Playgroud)
这是从这里:http://docs.xamarin.com/ios/recipes/General/Projects/Environment_Checks