简体   繁体   English

使用Connect将Facebook iOS SDK与评论集成

[英]Integrating Facebook iOS SDK with Comments using Connect

On an iOS application, I plan to host Facebook Comments using Facebook Connect within an UIWebView, have already done some tests and read articles where I think that it shall work fine. 在iOS应用程序中,我计划在UIWebView中使用Facebook Connect主持Facebook评论,已经做过一些测试并阅读文章,我认为它应该可以正常工作。 My question regards authentication: I wanted to use Facebook iOS sdk to have and store the proper tokens within Objective C, so that the user doesn't have to do it every time. 我的问题是关于身份验证:我想使用Facebook iOS sdk在Objective C中拥有并存储正确的令牌,这样用户就不必每次都这样做。 I know how to inject any data in the UIWebView if needed, but my question is WHAT do I need to inject so that the facebook scripts already see the user as authenticated every time ? 如果需要,我知道如何在UIWebView中注入任何数据,但我的问题是我需要注入什么才能让facebook脚本每次都看到用户进行身份验证? Thanks 谢谢

See https://developers.facebook.com/docs/authentication/ . 请参阅https://developers.facebook.com/docs/authentication/ You will get an access token when you authenticate the user which you can then use throughout your application to request information on the users behalf. 在对用户进行身份验证时,您将获得访问令牌,然后您可以在整个应用程序中使用该令牌来代表用户请求信息。

Download the latest Facebook iOS SDK . 下载最新的Facebook iOS SDK

Create the Facebook object: 创建Facebook对象:

Facebook *myFacebook;
[self myMethodToDoSomeAuthenticatedStuffsWithAccessToken:myFacebook.accessToken];

Also, you can see the sample "Hackbook" project to see how the access token is setup for the Facebook object within the application and how it is auto refreshed. 此外,您还可以看到示例“Hackbook”项目,以了解如何为应用程序中的Facebook对象设置访问令牌以及如何自动刷新。

This keeps the user authenticated on the iOS Device and you can use this access token a NSString* type to do your stuffs. 这样可以在iOS设备上对用户进行身份验证,并且您可以使用此访问令牌NSString *类型来执行您的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM