zoukankan      html  css  js  c++  java
  • facebook login issue

    If enable the facebook account in settings, when change account can't open the session.

    -(void)fbResync
    {
        ACAccountStore *accountStore;
        ACAccountType *accountTypeFB;
        if ((accountStore = [[ACAccountStore alloc] init]) && (accountTypeFB = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook] ) ){
    
        NSArray *fbAccounts = [accountStore accountsWithAccountType:accountTypeFB];
        id account;
        if (fbAccounts && [fbAccounts count] > 0 && (account = [fbAccounts objectAtIndex:0])){
    
        [accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
            //we don't actually need to inspect renewResult or error.
            if (error){
    
            }
        }];
    }
    }
    
    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:YES
                                  completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
         if(error)
         {
             NSLog(@"Session error");
             [self fbResync];
             [NSThread sleepForTimeInterval:0.5];   //half a second
             [FBSession openActiveSessionWithReadPermissions:permissions
                                                allowLoginUI:YES
                                           completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
                [self sessionStateChanged:session state:state error:error];
                                           }];
    
         }
         else
             [self sessionStateChanged:session state:state error:error];
     }];
    
    
    
    
    
  • 相关阅读:
    Struts2文件上传
    Struts2文件下载
    使用ajax()方法和后台交互
    简单的写数据到txt文件
    JPA初体验(使用Hibernate4实现)
    动态删除ArrayList中的元素
    MySQL5.5.15 源码 cmake 安装
    HeartBeat启动关闭mysqld服务的脚本修改
    MySQL MyISAM 转 Innodb
    2038/01/19 11:14:07 MySQL
  • 原文地址:https://www.cnblogs.com/iosdev/p/3288309.html
Copyright © 2011-2022 走看看