Opening Facebook Fan Page Or Profile Programmatically In iOS

Welcome to my new tutorial. Today, I'm going to show you how to open up a Facebook Fan Page or Profile Page programmatically in iOS using objective-c. It is pretty simple. Use the code below. Of course do not forget to set your URL string. Take note that you need also to take the profile ID of your fan page or your profile. In this case, the digit: 834967416576011 is the same with viralcompilations

    NSURL *fanPageURL = [NSURL URLWithString:@"fb://profile/834967416576011"];
    if (![[UIApplication sharedApplication] canOpenURL:fanPageURL])
        fanPageURL =   [ NSURL URLWithString:@"https://www.facebook.com/viralcompilations"];
     
    [[UIApplication sharedApplication] openURL:fanPageURL];

Easy, right? If you find this helpful, don't forget to share and subscribe to my blog!

Post a Comment