YAFBLQ: How to pre-populate FB login and password fields?
Yet another fb login question:
By the time my user has something to share, they've already logged into my app server. I give them the option to use their FB creds for my app. So if they share, I want to开发者_开发技巧 pre-populate the FB login page with the creds they've already supplied to me.
Does anyone know if this is possible, and if so, how to do it?
Here's what I'm talking about:
I use Facebook API too. You never keep login and pass in your app (check Facebook API doc). However you can keep session. So the user enter login and pass once. In my code I've a "FacebookLogger" who is a singleton with a Facebook object.
To store session I use NSUserDefaults (find doc here).
[[NSUserDefaults standardUserDefaults] setObject:m_Facebook.accessToken forKey:@"AccessToken"];
[[NSUserDefaults standardUserDefaults] setObject:m_Facebook.expirationDate forKey:@"ExpirationDate"];
[[NSUserDefaults standardUserDefaults] synchronize];
Where m_Facebook is my Facebook object in my singleton. After that I can catch Access with :
m_Facebook.accessToken = [[NSUserDefaults standardUserDefaults] stringForKey:@"AccessToken"];
m_Facebook.expirationDate = (NSDate *) [[NSUserDefaults standardUserDefaults] objectForKey:@"ExpirationDate"];
精彩评论