7

I'm currently working on a multiplatform app for iPhone and various other devices, as far as I can work out I can use preprocessor directives to check if I'm building for iPhone or another platform, so for example I could have:

#if WINDOWS_PHONE
ScreenRes = new Vector2(800,480);
#endif

#if XBOX360
ScreenRes = new Vector2(1280,720);
#endif

However I'm not sure which declaration I'm supposed to use to check for iPhone, I've already tried IPHONE, IOS, I_PHONE and a few others.

meds
  • 21,699
  • 37
  • 163
  • 314

2 Answers2

8

We do not define any by default. You can do this by adding the define yourself when you build it with MonoDevelop to your configurations.

miguel.de.icaza
  • 32,654
  • 6
  • 58
  • 76
4

Recent versions of Xamarin Studio will provide extra defines to the compiler.

E.g. for Xamarin.iOS both __MOBILE__ and __IOS__ will be defined.

E.g. for Xamarin.Android both __MOBILE__ and __ANDROID__ will be defined.

poupou
  • 43,413
  • 6
  • 77
  • 174