2013-05-17 64 views
0

我使用這個代碼:的iOS 6的Facebook不工作

_accountStore = [ACAccountStore new]; 

    ACAccountType *facebookTypeAccount = 
    [_accountStore accountTypeWithAccountTypeIdentifier: 
    ACAccountTypeIdentifierFacebook]; 

    NSArray *accounts = 
    [_accountStore accountsWithAccountType: 
    facebookTypeAccount]; 

    _facebookAccount = [accounts lastObject]; 

    [_accountStore requestAccessToAccountsWithType:facebookTypeAccount 
              options:@{ACFacebookAppIdKey:myKey, ACFacebookPermissionsKey:@[@""]} 
             completion:^(BOOL granted, NSError *error) { 
              if(granted) 
              { 
               NSArray *accounts = [_accountStore accountsWithAccountType:facebookTypeAccount]; 
               _facebookAccount = [accounts lastObject]; 
               NSLog(@"Success"); 

               [self parseUserDataWithCompletion:completion]; 
              } 
              else 
              { 
               NSLog(@"Error: %@", error); 

               [self parseUserDataWithCompletion:completion]; 
              } 
             }]; 

作品就好在設備上。但是,在模擬器上運行給出了錯誤:

Error Domain=com.apple.accounts Code=7 "The operation couldn’t be completed. (com.apple.accounts error 7.)" 

UPDATE: 它不工作的設備上無論是。

它曾經工作。但現在不再了......發生什麼事了? fb改變了什麼?

+0

那用戶拒絕的權限錯誤。 –

回答

2

已解決。問題是:

ACFacebookPermissionsKey:@[@""] 

不得不改爲

ACFacebookPermissionsKey:@[]