Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

how to determine whether running on the simulator or a device

patcarutherspatcaruthers USMember ✭✭✭

I think you used to be able to tell from the results of UIDevice.CurrentDevice.Model
but now everything says "iPhone".

TARGET_OS_SIMULATOR is not defined

Is there anyway to tell? my app uses somethings that can't work on the simulator
and would like to know so I can put in some workarounds for those features.

Best Answer


  • PeterMidgleyPeterMidgley USMember ✭✭

    I found it had to be coded like this:
    if (ObjCRuntime.Runtime.Arch != ObjCRuntime.Arch.SIMULATOR)

Sign In or Register to comment.