Reputation: 1
I am trying to link our facebook app page to our app, so users can open from our app fan page on Facebook.
I tried :
NSURL *fanPageURL = [NSURL URLWithString:@"fb://profile/APPNAME"];
[[UIApplication sharedApplication] openURL:fanPageURL];
Where app name is the name appears on the url of our facebook fan page. What happens is that it opens the facebook app at my personal profile and not the relevant page.
Why is that ? (i dont have any page id to insert to that url )
Upvotes: 1
Views: 1983
Reputation: 6524
This code guarantee that if the user don't have the Facebook app, the page will be opened in safari
In this case you have to put your page name and id as follow:
NSURL *fanPageURL = [NSURL URLWithString:@"fb://profile/pageID"];
if (![[UIApplication sharedApplication] canOpenURL:fanPageURL])
fanPageURL = [ NSURL URLWithString:@"https://www.facebook.com/pageName"];
[[UIApplication sharedApplication] openURL:fanPageURL];
Upvotes: 5