0

I'm currently writing an app that uses Facebook integration built into iOS 6. Now in order to do that, I need to

#import <Social/Social.h>

How do I ensure that the device can actually run the code and won't crash (check if it's iOS 6 or iOS 5.1 and then performing the right code, because I support iOS 5.1<= )?

Mick MacCallum
  • 126,953
  • 40
  • 282
  • 279
Lior Pollak
  • 2,973
  • 5
  • 25
  • 46

2 Answers2

4

You could use:

[[UIDevice currentDevice] systemVersion]
CSolanaM
  • 1,568
  • 15
  • 19
3

This works fine for me:

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")){
//Use social framework
}else{
//other option
}
  • Oh thank you! This should work better than the marked answer, I will confirm and mark – Lior Pollak Feb 04 '13 at 18:08
  • 2
    Won't work unless you define it somewhere: http://stackoverflow.com/questions/7848766/how-can-we-programmatically-detect-which-ios-version-is-device-running-on – Ngoan Nguyen Feb 06 '13 at 21:25