objective-c - 从我的应用程序启动 Facebook——空白页

标签 objective-c cocoa-touch ios facebook

我有一个关于在 iPhone/iPod/iPad 设备上启动 Facebook 的问题。我构建了一个应用程序,其中有一个启动官方 Facebook 应用程序的按钮(如果用户没有 Facebook 应用程序,它将在 Safari 中启动它)。所以这是我用来启动 Facebook 的代码:

NSURL *url = [NSURL URLWithString:@"fb://106452802751829"];
[[UIApplication sharedApplication] openURL:url];

但问题是它在 Facebook 应用程序中显示空白页面。我再次修改了代码,在我的 Facebook 粉丝页面的 ID 上检查了两次,但除了一个空白页面之外什么也没有。所以现在我不知道该怎么办。我希望有人可以帮助我在官方 Facebook 应用程序上启动实际的粉丝页面;谢谢。

最佳答案

查看此 Wiki iPhone URL Schemes

此信息来自 iPhoneDevTools 网站。

NSURL *url = [NSURL URLWithString:@"fb://<insert function here>"]; 
[UIApplication sharedApplication] openURL:url];

You can use these options: fb://profile – Open Facebook app to the user’s profile fb://friends – Open Facebook app to the friends list fb://notifications – Open Facebook app to the notifications list (NOTE: there appears to be a bug with this URL. The Notifications page opens.

However, it’s not possible to navigate to anywhere else in the Facebook app) fb://feed – Open Facebook app to the News Feed fb://events – Open Facebook app to the Events page fb://requests – Open Facebook app to the Requests list fb://notes- Open Facebook app to the Notes page fb://albums – - Open Facebook app to Photo Albums list This "works" but, then again, doesn't: fb://post/ It only works if the Facebook app has previously loaded the particular post, otherwise it draws a blank.

关于objective-c - 从我的应用程序启动 Facebook——空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5794388/

相关文章:

ios - 如何将 UILabel 添加到 UIScrollView?

iphone - 如何在表格单元格中使用 UIWebView?

objective-c - 检测 UIScrollview 滚动超过底部

ios - 在 iOS 中使用 Socket 上传和流式传输视频

ios - iOS App 无 NULL 值和重复数据的数据库设计

iphone - 退出编辑模式并更新导航栏项目

ios - 在框架中查看 Controller 生命周期方法回调?

objective-c - 如何获取 Mac(Cocoa 或 C)的电池电量,具体以 mWh(而非百分比)为单位

iphone UIDatePicker 在中央时区显示错误的日期

ios - 可以 FileManager.default.urls(for :in:) be used to get tmp/directory in iOS?