1

I am new to Facebook and Twitter integrations. I am able to integrate them in individual versions, i.e iOS4 and iOS5.

I am facing difficulty in checking the condition that based on the version, need to integrate Twitter and Facebook functionalities.

Can anyone suggest me regarding this.

Daniel
  • 23,129
  • 12
  • 109
  • 154
Roopa
  • 15
  • 6
  • thanks for editing Mr.Daniel.actually i am new one to ask questions here.and suggest me if any mistakes are there. – Roopa Aug 10 '12 at 06:00

1 Answers1

0

iOS version check

NSArray *versionCompatibility = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];

if ( 5 == [[versionCompatibility objectAtIndex:0] intValue] ) { /// iOS5 is installed

    // Put iOS-5 code here

} else { /// iOS4 is installed

    // Put iOS-4 code here         

}

Happy Coding :)

EDIT 1

So you can find the iOS version with this also

if (NSClassFromString(@"TWTweetComposeViewController") != nil) { /// iOS5 is installed

    // Put iOS-5 code here

} else { /// iOS4 is installed

    // Put iOS-4 code here         

}

Or Can Check this out the most up-voted answer for this type of question

Community
  • 1
  • 1
The iOSDev
  • 5,237
  • 7
  • 41
  • 78
  • At the time of tap on sharing button ie at the time of integration of FB or Twitter, or in appDelegate for global excess :) – The iOSDev Aug 09 '12 at 11:24
  • thanks for ur valuable reply. it works for me. once again thank alot @Aalok Parikh – Roopa Aug 09 '12 at 11:39
  • YWC and happy to help and also my answer is working for you :) – The iOSDev Aug 09 '12 at 11:42
  • I and many more developers will discourage version checking. Rather you should do a feature check. If there is no Twitter framework, then use a fallback. But avoid assuming too much by checking system version numbers etc. – Daniel Aug 10 '12 at 00:57
  • may i know what is fallback?@Daniel. actually i dont know about that. – Roopa Aug 10 '12 at 05:45
  • So does this one is good @Daniel If so please up-vote or just remove down-vote – The iOSDev Aug 11 '12 at 06:22