views:

150

answers:

3

I see in the documentation that UISwipeGestureRecognizer is available in Iphone OS 3.2 and later. I was planning to use this to detect swipe gestures in my Application. What would be the consequences of running my application in an older OS say 3.1.3 if I do implement UISwipeGestureRecognizer?

A: 

GestureRecognizers are only available in >= iOS 3.2, so you can't use them in iOS 3.1.3 anyway.

Douwe Maan
does that mean people running < IOS 3.2 wont be able to install my app?
Rupert
A: 

If you code for backwards compatibility, meaning you check that a class or method exists before you use it, then pre 3.2 users would simply not be able to swipe. Otherwise you should mark your application as requiring 3.2 or later to run.

Class c = NSClassFromString( @"UISwipeGestureRecognizer" );

if ( c ) {
  UISwipeGestureRecognizer *recognizer = [[c alloc] init];
} else {
  // pre 3.2 do something else
}
drawnonward
A: 

The Apple documentation says that it is only available in iOS 3.2 and later, but this is not the whole story! Code which uses UISwipeGestureRecognizer compiles without an error or warning when "iPhone OS Deployment Target" is 3.1.3, and it works fine on my 3.1.3 device.

I guess that before 3.2 UISwipeGestureRecognizer was considered "undocumented API".