Detecting iOS Simulator vs iOS device

I am working on a project using Xamarin.iOS, and I have a situation where the behavior in the simulator inexplicably does not coincide with the real device (setting the viewing center area in different ways).

I want to be able to set a value for a variable at runtime based on whether the application is running on a simulator or on a real device. How can I detect this?

+7
source share
1 answer

You can execute other code at runtime as follows:

if (MonoTouch.ObjCRuntime.Runtime.Arch == Arch.DEVICE) { } else { } 

But it’s always useful to investigate (ask here, forums, bug reports) why the behavior is different from the two (just to make sure that it does not hide an error that may bite you later).

+11
source

All Articles