我正在使用PARSE集成facebook。我能够成功地将用户链接到Facebook但是当我尝试获取facebook firiends列表时,我收到以下错误。
FBRequest * request = [FBRequest requestForMyFriends];
// Send request to Facebook
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
}];
错误代码= 100
message ="(#100)未知字段:用户名。"
type = OAuthException
迫切需要帮助!!
答案 0 :(得分:1)
图谱API v2.0不再提供字段username
,请参阅https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api
端点在v2.0中不再可用:
... / me / username不再可用。
答案 1 :(得分:0)
-(IBAction)btnFacebookClick:(id)sender
{
NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_about_me,user_birthday,user_hometown,user_location,email",@"read_mailbox",@"read_stream",nil];
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState status,NSError *error)
{
if(error)
{
NSLog(@"session error %@",error);
}
else if(FB_ISSESSIONOPENWITHSTATE(status))
{
[self getFriendList];
}
}];
}
-(void)getFriendList
{
FBRequest *friendsRequest=[FBRequest requestForMyFriends];
[friendsRequest startWithCompletionHandler:^(FBRequestConnection *connection,NSDictionary* result,NSError *error)
{
friendsArr = [result objectForKey:@"data"];
NSLog(@"friends description :%@",[friendsArr description]);
}];
}