2013-10-23 9 views
6

: nedeni: 'FBSession: açamıyor mevcut haliyle' dan belirteç verilerden bir oturumnedeni: 'FBSession: bugünkü durumundan belirteç verilerden bir oturum açamıyor' Ben bir önbelleğe tokenData</p> <p>dan Facebook'a oturum açmak istiyoruz ama bu hata düşmek

kodum:

FBAccessTokenData *savedAccessTokenData =[TokenCacheStrategy getSavedToken]; 

if(savedAccessTokenData!nil){ 

[appDelegate.session openFromAccessTokenData:savedAccessTokenData completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { 
       if(appDelegate.session.isOpen){ 
        NSLog(@"session opened from saved access token"); 
        NSLog(@"accesstoken: %@",[appDelegate.session.accessTokenData accessToken]); 
        if(completionBlock!=NULL){ 
         completionBlock(); 
        } 

       }//session is open from token data 

} 

cevap

1

Erişim belirteçleri genellikle öngörülen zaman aralığı örneğin sonra sona erer. 1 saat . herhangi önbelleğe belirteç bilgi daha sonra bunu yolunuzu açmaya ve blok başka bloğunda sonra başarısız olursa eğer bunu temizlemek ve kullanan bir yeni bir oturum açmayı deneyebilirsiniz gidecekseniz ise:

// If the session state is any of the two "open" states when the button is clicked 
if (FBSession.activeSession.state == FBSessionStateOpen 
    || FBSession.activeSession.state == FBSessionStateOpenTokenExtended) { 

    // Close the session and remove the access token from the cache 
    // The session state handler (in the app delegate) will be called automatically 
    [FBSession.activeSession closeAndClearTokenInformation]; 

    // If the session state is not any of the two "open" states when the button is clicked 
} else { 
    // Open a session showing the user the login UI 
    // You must ALWAYS ask for basic_info permissions when opening a session 
    [FBSession openActiveSessionWithReadPermissions:@[@"basic_info"] 
             allowLoginUI:YES 
            completionHandler: 
    ^(FBSession *session, FBSessionState state, NSError *error) { 
     [self sessionStateChanged:session state:state error:error]; 
    }]; 
İlgili konular