如何在iphone应用程序中打开Facebook页面? [英] How to open facebook page in facebook app in iphone?
问题描述
我有以下页面,我想在Facebook应用程序中显示: http://www.facebook.com/mypage
我尝试执行以下操作,但似乎不起作用:
NSURL * urlApp = [NSURL URLWithString:@fb:// profile / mypage];
[[UIApplication sharedApplication] openURL:urlApp];
我也试过 @fb:// mypage
具有相同的否定结果。
应用程序是开放的,但不需要页面。
要在Facebook应用程序中打开Facebook页面,您应该: p>
1)找到你的页面(可以通过查看你的Facebook页面的源代码来完成)
我从页面的源代码得到以下片段: http://www.facebook.com/yourpage
{text:yourpage,type:ent:page,uid:**** 123 ****}
注意:检查uid是否正确替代uid for pagename: http:// www。 Facebook.com / **** 123 ****
此网址应该打开您的页面。
2)当发现uid时,是正确的使用这段代码:
NSURL * urlApp = [NSURL URLWithString:@fb:// profile / **** 123 ****];
[[UIApplication sharedApplication] openURL:urlApp];
此代码将在Facebook应用程序中打开您的页面。注意:如果([[UIApplication sharedApplication] canOpenURL:urlApp]),请不要忘记检查是否存在Facebook应用程序(或更确切地说可以打开该URL)否则在Safari中打开它。
I have the following page I want to show in facebook app: http://www.facebook.com/mypage
I try to do the following but it doesn't seem to work:
NSURL *urlApp = [NSURL URLWithString:@"fb://profile/mypage"];
[[UIApplication sharedApplication] openURL:urlApp];
also I tried @"fb://mypage"
with the same negative result.
Application is open but without the page needed.
To open facebook page in facebook app you should:
1)Find uid of your page (it can be done for example by looking at source code of your facebook page)
I got the following fragment from the source code of the page: http://www.facebook.com/yourpage
{"text":"yourpage","type":"ent:page","uid":****123****}
N.B.: To check if uid is correct substitute uid for pagename: http://www.facebook.com/****123****
This url should open your page.
2) When the uid is found and is correct use this code:
NSURL *urlApp = [NSURL URLWithString:@"fb://profile/****123****"];
[[UIApplication sharedApplication] openURL:urlApp];
This code will open you page within facebook app. N.B.: Do not forget to check if the facebook app exists( or more precisely that the url can be opened) using: if ([[UIApplication sharedApplication] canOpenURL:urlApp])
otherwise open it in Safari.
这篇关于如何在iphone应用程序中打开Facebook页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!