开发者

hide facebook authorization dialog iPhone

开发者 https://www.devze.com 2023-03-12 23:37 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消