2015-09-25 57 views
0

我的Facebook登錄解析工作完全沒有問題,但生成的訪問令牌沒有顯示好友列表的權限,雖然我在登錄時給予該權限。當我使用Facebook Graph API'Friendlists'(fbID/friendlists)並且響應數組爲空時,我開始知道。因此,也使用生成的相同訪問令牌運行Graph API Explorer。它不告訴我任何錯誤和數據陣列是相同的空白,並與解析'pfloginviewcontroller'某些Facebook權限不能在ios中工作

調試信息「領域‘好友列表’僅在用戶對象上的用戶授予「read_custom_friendlists的許可後,訪問」

這是我使用的方法

WLLoginViewController *login = [[WLLoginViewController alloc]init]; 
login.fields = PFLogInFieldsFacebook; 
NSArray *permission = [[NSArray  alloc]initWithObjects:@"email",@"read_custom_friendlists",@"publish_actions",@"user_location",@"user_hometown",@"user_website",@"user_about_me",@"user_photos",@"user_friends",@"read_custom_friendlists", nil]; 

login.facebookPermissions = permission; 

WLLoginViewController繼承PFUserLoginManager,我從其他類調用它。

- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user { 

[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
    NSLog(@"permissions%@",logInController.facebookPermissions); 
    if(result) { 
     if ([result valueForKey:@"hometown"]) { 
      NSString *nn = [[result valueForKey:@"hometown"] valueForKey:@"name"]; 
      [user setValue:[[result valueForKey:@"hometown"] valueForKey:@"name"] forKey:@"hometown"]; 
     } 
     if ([result valueForKey:@"location"]) { 
      [user setValue:[[result valueForKey:@"location"] valueForKey:@"name"] forKey:@"location"]; 
     } 
     [user setObject:[result valueForKey:@"id"] forKey:kWLUser_FacebookId]; 
     [user setObject:[result valueForKey:@"name"] forKey:kWLUser_Name]; 
     [user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { 
      if([PFInstallation currentInstallation]) { 
       // save in background current installation. 
       [[PFInstallation currentInstallation] setObject:user forKey:@"user"]; 
       [[PFInstallation currentInstallation]saveInBackground]; 
      } 
     }]; 
     [[ParseManager sharedInstance]saveDeviceToken:[[NSUserDefaults standardUserDefaults]objectForKey:@"DeviceToken"]]; 
     [self dismissViewControllerAnimated:YES completion:nil]; 
    }else { 
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Could not login" message:@"Could not login to facebook, please try again" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil]; 
     [alert show]; 
    } 
}]; 

} 這是這是其當在代碼的用戶返回到應用程序從facebook.The的NSLog是示出了許可完美其中我給運行方法。

最後,這是用於處理Facebook的要求 方法 - (無效){handleFacebookFriendsRequest

NSString *queryParams = @"id,name,picture.width(350).height(250),location,hometown,likes.limit(100000),statuses.limit(1),languages"; 
[queryParams stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
NSLog(@"%@",[FBSession activeSession].permissions); 
NSLog(@"%@",[[FBSession activeSession].permissions description]); 
NSLog(@"%@",[FBSession activeSession].accessTokenData.accessToken); 
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"me/friends?fields=%@",queryParams] completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
    if (!error) { 
     //change For getting everything out 
     NSLog(@"%@",[result objectForKey:@"data"]); 
     [[ApplicationDataModel sharedInstance]setFacebookFriendsList:[result objectForKey:@"data"]]; 
     [self facebookRequestDidLoad:result]; 
    } else { 
     [self facebookRequestDidFailWithError:error]; 
    } 

}]; 
} 

enter image description here

我被困急需幫助。

回答

0

的read_custom_friendlists提前感謝是不是默認的權限,因此你必須要經過審批流程此功能(https://developers.facebook.com/docs/facebook-login/permissions/v2.2

要提交項目審批轉到: developers.facebook.com - >我的應用 - >狀態&評論

警告:在你的應用程序儀表板的角色部分上市「人 - 包括管理員,開發人員和測試 - 可以授予任何權限,而檢討,只要人們在這些角色將使用你的應用程序,你不需要提交登錄評論「。(https://developers.facebook.com/docs/apps/faq

+0

否我必須將該朋友列表顯示給用戶,以便他可以向他們發送邀請加入我們的應用程序。 –

+0

我必須爲此請求read_custom_friendlists嗎?我添加了'user_friends',它只是將我的應用程序管理員的好友列表帶給我..這裏應該是什麼問題? –