Can I use UIKeyboardType.DecimalPad (in MonoTouch) and still retain iOS 3.x compatibility?

901 views Asked by At

Apple introduced a new "decimal pad" keyboard type in iOS 4.1 (I think). I'd like to use this in my app, but I'd also like the app to be 3.x compatible.

I thought it would be impossible, but, when setting my app to support "Minimum OS version: 3.0", it compiles with this constant in use.

I don't have a 3.x device to hand, and can't seem to force the simulator to run my app under 3.x, so I'm confused as to what is happening. Will it crash on a 3.x device and, if so, why is it compiling when I've set the compiler for 3.0 support?

I know there are ways of simulating in the DecimalPad keyboard in iOS 3.x, but I'm specifically interesting in this version issue.

Update

My tests suggest that iOS 3.x maps "invalid" keyboard types to the default keyboard.

2

There are 2 answers

0
Kevin Renskers On BEST ANSWER

Running your app on a 3.x device will result in a crash. It does compile because your SDK is newer. Sadly you cannot change the simulator to just any version, for example I can only test 3.2, 4.1 and 4.2. It is always a good idea to keep an old version of XCode and the iPhone SDK lying around (you can install them side by side).

Of course you can still use the new decimal pad in your app, just put it inside a condition that checks for the iOS version and thus maintain compatibility with 3.x (see How to check iOS version? about iOS version check).

0
Tron5000 On

In the simulator I believe you can run against a different version of the SDK by changing the Hardware -> Version settings.

Your app compiles because you have a newer version of the SDK installed (4.1+). However, installing on a device earlier than iOS 4.1 will probably cause runtime issues.