[MonoTouch] XCode 4.2

Nic Wise nicw at fastchicken.co.nz
Mon Oct 31 17:14:08 EDT 2011


You dont need both installed.

If you make an app with 4.2 (and MT5), it will work just fine on a
iOS4 (or 3.1.3) device as long as you dont call any methods which are
not available in the version your user is using.

So lets say you have a class called UIMyCoolView. It has the following methods:

void DoABasicFunction(); (available for 3.0 onwards)
void DoSomethingSlightlyCooler(); (4.1 onwards)
void DoSomethingInTheCloud(); (5.0 onwards)

if you call

var coolview = new UIMyCoolView();
coolview.DoABacicFunction(); // this will work on all devices
coolview.DoSomethingSlightlyCooler(); // this will crash / throw an
exception on 4.0 or 3.x,  but work on 4.1 or better
coolview.DoSomethingInTheCloud(); // will cash on 4.x or 3.x, workd on 5.x

So, this piece of code is going to be VERY useful to you:

public static bool IsIOS41OrBetter
		{
			get
			{
				string version = UIDevice.CurrentDevice.SystemVersion;
				
				string[] versionElements = version.Split('.');
				
				if (versionElements.Length > 0)
				{
					int versionInt = 0;
					int minorVersion = 0;
					if (Int32.TryParse(versionElements[0], out versionInt))
					{
						if (Int32.TryParse(versionElements[1], out minorVersion))
						{
							if (versionInt >= 5) return true;
							
							return (versionInt >= 4 && minorVersion >= 1);
						}
					}
					
					return false;
					
				}
				
				return false;
				
			}
			
		}

(4.1 is my minimim)

this lets me doing things like this:

public static UIKeyboardType DecimalKeyboardType
		{
			get
			{
				if (IsIOS41OrBetter)
				{
					return UIKeyboardType.DecimalPad;
				}
				return UIKeyboardType.NumbersAndPunctuation;
			}
		}

UIKeyboardType.DecimalPad only exists in 4.1 or newer.

Does that make sense?

This is why iPod Touch 3rd gen (basically, a 3G without the phone) are
so valuable - you can keep them on 4.2 for testing, or better yet,
keep them on 4.0 or 3.1.3 if you need to support that far back.
Personally, I stop at 4.0 now.



2011/10/31 Andreas Ploetzeneder <info at ploetzeneder-it.com>:
> Hi,
> how can i make Adhoc distributions for devices with ioS 4 with Xcode 4.2 or
> can i install it parallel to XCode 4.1
>
> --
>
>
>
>
>
> Mit freundlichem Gruß,
>
> Andreas Plötzeneder
> CEO
> ihr ploetzeneder it-solutions Team
> Mobile Development – Desktopanwendungen – Webanwendungen
> Tel:  +43 720 30 30 24 10
> Fax: +43 720 30 30 24 20
> Email: info at ploetzeneder-it.com
> web:   http://www.ploetzeneder-it.com
>
> Der Inhalt dieser E-Mail samt aller Anhänge ist vertraulich
> und ausschließlich für den Adressaten bestimmt. Wenn Sie nicht der
> vorgesehene Adressat dieser E-Mail oder dessen Vertreter sind, so löschen
> sie diese bitte und informieren Sie den Absender. Jede Form der Verbreitung
> oder Veröffentlichung der E-Mail, sei es in ihrer Gesamtheit oder in Teilen,
> die nicht ihrem Zweck dient, ist unzulässig. Das Internet kann die
> Unversehrtheit dieser Mitteilung nicht garantieren. ploetzeneder
> it-solutions übernimmt daher keine Haftung, falls die E-Mail geändert wurde.
>
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2


More information about the MonoTouch mailing list