2013-06-12 52 views
0

當我的應用程序嘗試邀請用戶的朋友列表中的人員時,它會檢查活動會話的權限。如果這些權限都沒有找到,它會調用reauthorizeWithPublishPermissions。com.facebook.sdk錯誤2當嘗試以不同的發佈權限重新授權

有問題的代碼如下:

if ([FBSession.activeSession.permissions indexOfObject:@"publish_stream"] == NSNotFound || [FBSession.activeSession.permissions indexOfObject:@"user_photos"] == NSNotFound) { 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 

    [defaults setBool:YES forKey:@"FacebookLogin"]; 
    [FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:@"publish_stream",@"user_photos", nil] 
      defaultAudience:FBSessionDefaultAudienceFriends 
     completionHandler:^(FBSession *session, NSError *error) 
          { 
           if (error) 
           { 
            UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Can not get permission" 
                        message:error.localizedFailureReason 
                        delegate:self 
                      cancelButtonTitle:@"Ok" 
                      otherButtonTitles:nil]; 
            [alert show]; 
            [alert release]; 
            [defaults setBool:YES forKey:@"FacebookLogin"]; 
           } 
           else { 
            if([[SocialNetworkingData getInstance] getFBDisplayType] == 0) 
            { 
             [self postFeedWithPermission:friendList]; 
            } 
            else if ([[SocialNetworkingData getInstance] getFBDisplayType] == 1) 
            { 
             [self postPhotoWithPermission:friendList]; 
            } 
            else if([[SocialNetworkingData getInstance] getFBDisplayType] == 2){ 
             [self postFeedDialog:friendList]; 
            } 

           } 
          }]; 
} 

else 
{ 
    if([[SocialNetworkingData getInstance] getFBDisplayType] == 0) { 
     [self postFeedWithPermission:friendList]; 
    } 
    else if ([[SocialNetworkingData getInstance] getFBDisplayType] == 1) { 
     [self postPhotoWithPermission:friendList]; 
    } 
    else if([[SocialNetworkingData getInstance] getFBDisplayType] == 2){ 
     [self postFeedDialog:friendList]; 
    } 
} 

無論什麼時候,完成處理器接收到錯誤2.

回答

0

瞭解您的應用被授權在設置> Facebook的^ _^

+0

嘿,是的,它最終成爲我特別使用的帳戶的問題。 – Cameron