如何保存Facebook用户信息与Facebook登录IOS应用程序 [英] How to cache Facebook User Info with Facebook Login in IOS App

查看:303
本文介绍了如何保存Facebook用户信息与Facebook登录IOS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Facebook SDK 3.1集成到我的iOS 5应用程序中。在Facebook登录后,我必须像这样查询以获取用户信息

  NSString * query = @SELECT uid,name,pic_big ,username FROM user where uid = me(); 

NSDictionary * queryParam =
[NSDictionary dictionaryWithObjectsAndKeys:query,@q,nil];

[FBRequestConnection startWithGraphPath:@/ fql
参数:queryParam
HTTPMethod:@GET
completionHandler:^(FBRequestConnection * connection,
ID结果,
NSError *错误){...

现在有两个问题使用这种方法:



1-用户刚刚等待自己从Facebook和
身份验证,之后他必须等待再次获得他的基本个人资料
将从网页中提取。



-Q-如何使用Facebook登录网络电话获取此信息?



-2-当用户从登录屏幕重新打开应用程序时,如果FBSession仍然打开并且有效,Facebok将会重新验证该用户,但是我仍然必须获得他的基本

来自网络的个人资料信息...



-Q-如何在用户的应用中缓存用户的基本个人资料信息? FBSession对象中有哪些ID可以缓存用户信息?



提前感谢。
Moeen。

解决方案


1-用户刚刚等待自己从Facebook身份验证和
之后,他必须等待再次获得他的基本配置文件
信息从网络上提取。



-Q-如何我可以通过Facebook登录网络电话获取这个信息吗?


原始的等待时间应该是最小的,正确使用。您不能将API调用附加到登录请求。 Facebook曾经有一个preload_fql工具,但不再支持。


-2-当用户从登录屏幕重新打开应用程序时,如果FBSession仍然是开放和有效的Facebok将重新认证该用户,但我将
仍然必须从网络获取他的基本配置文件信息...



-Q-如何缓存用户的基本个人资料信息在我的应用程序? FBSession对象中有哪些ID可以缓存用户信息?


这是您应用程序设计的一个问题。我的建议是创建一个NSMutableDictionary作为一个类属性,并调用它 cached_user_data 或其他东西。保存用户数据。


I am integrating Facebook SDK 3.1 to my iOS 5 app. After Facebook Login, I have to query like this to get user info

NSString *query = @"SELECT uid, name, pic_big,username FROM user where uid = me()";

NSDictionary *queryParam =
[NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];

[FBRequestConnection startWithGraphPath:@"/fql"
                             parameters:queryParam
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection,
                                          id result,
                                          NSError *error) { ....

Now there are two issues with this approach:

1- User has just waited to get himself authenticated from Facebook and now just after that he has to wait again for to get his basic profile info to be fetched from web.

-Q- How can I fetch this info with the Facebook Login web call?

-2- When user reopens the app from login screen, if FBSession is still open and valid Facebok will re-authenticate that user but I would still have to get his basic
profile info from web...

-Q- How can I cache user's basic profile info in my app? Is there any id in FBSession object on which I could cache the user info?

Thanks in advance. Moeen.

解决方案

1- User has just waited to get himself authenticated from Facebook and now just after that he has to wait again for to get his basic profile info to be fetched from web.

-Q- How can I fetch this info with the Facebook Login web call ?

The original wait times should be minimal with proper usage. You cannot "append" an API call to a login request. Facebook used to have a preload_fql tool, but no longer supports that.

-2- When user reopens the app from login screen, if FBSession is still open and valid Facebok will re-authenticate that user but I would still have to get his basic profile info from web ...

-Q- How can I cache user's basic profile info in my app ? Is there any id in FBSession object on which I could cache the user info ?

This is a matter of your application design. My suggestion would to create a NSMutableDictionary as a class property, and call it cached_user_data or something. Save user data in there.

这篇关于如何保存Facebook用户信息与Facebook登录IOS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆