I have a program that authorize on facebook with cookies. So the modal dialog with facebook authorizing every time displaying. I want 开发者_C百科to hide it from user. Any help please..
When your login was successful you could do something like:
[[NSUserDefaults standardUserDefaults] setObject:_facebook.accessToken forKey:@"FBAccessToken"];
[[NSUserDefaults standardUserDefaults] setObject:_facebook.expirationDate forKey:@"FBExpirationDate"];
[[NSUserDefaults standardUserDefaults] synchronize];
then when your application starts up, do something similar to this:
if ( [[NSUserDefaults standardUserDefaults] objectForKey:@"FBAccessToken"] != nil ) {
_facebook.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"FBAccessToken"];
_facebook.expirationDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"FBExpirationDate"];
}
What this is doing is, that it saves the "cookie" of the facebook authentication and reuses it when the application is restarted.
Hope this helps.
精彩评论