Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook integration for ios 5 & ios 6

I want to integrate Facebook both for ios 5 and ios 6.

I have the knowledge of integrating facebook in individual ios(i.e ios 5 or ios 6), but have no idea of how to support facebook for both ios 5 and ios 6.

In the other words, how to integrate facebook both for ios 5 and ios 6 ? or what is the common way to support this in both ios?

Thanks

like image 693
user1673099 Avatar asked Dec 28 '12 05:12

user1673099


Video Answer


1 Answers

Well if you want to use the facebook integration within iOS6, and if the iOS version is lower than 6 , you want to use the Facebook SDK for iOS, you can check for the availability of the integrated Facebook service class in the Social Framework. Also you would have to import the Social Framework for it.

#import<Social/Social.h>

You can check for the availability of the integrated facebook service by something like this in the buttonAction method

- (void)buttonAction:(id)sender
{
    //Check for availability of Facebook integration and use its view controller to share on Facebook
    if(NSClassFromString(@"SLComposeViewController") != nil) {
        SLComposeViewController *fbController=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
            //Use fbController for sharing
        } else {
            // Service not available
        }
    }
    else{
        // Use your code for sharing on iOS versions other than 6.x to authenticate and get an access token.
    }
}

Hope it helped.

like image 177
Zen Avatar answered Oct 05 '22 15:10

Zen