图谱API错误域= com.facebook.sdk代码= 5

时间:2014-11-25 03:10:07

标签: ios objective-c iphone facebook facebook-graph-api

我知道在这个网站上有很多相同的问题,但仍然找不到原因。我有一个Facebook帐户然后我转到开发者Facebook页面创建一个应用程序然后我创建一个集成了Facebook API的iOS应用程序(登录,获取朋友列表)。然后,当我登录以获得上述Facebook帐户的taggable-friends时,一切正常。问题是当我尝试通过另一个Facebook帐户登录时,我得到taggable-friends list时出错。这是我的代码:

[FBRequestConnection startWithGraphPath:@"/me/taggable_friends"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          NSDictionary *result,
                                          NSError *error
                                          ) {
                          /* handle the result */
                          NSArray *data = [result objectForKey:@"data"];
                          for (FBGraphObject<FBGraphUser> *friend in data) {
                              NSDictionary *picData = [friend objectForKey:@"picture"];
                              NSDictionary *picDetail = [picData objectForKey:@"data"];

                              [friendsList addObject:[friend name]];
                              [avatarLink addObject:[picDetail objectForKey:@"url"]];
                              NSLog(@"name: %@,Link: %@", [friend name], [picDetail objectForKey:@"url"]);
                          }
                          dispatch_async(dispatch_get_main_queue(), ^{
                              [tblView reloadData];
                          });

                      }];

我也尝试通过代码来修复:[FBSession setActiveSession:self.session];但是没有用。错误如下:

  Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x7f9bea9172a0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x7f9be86297f0, state: FBSessionStateOpen, loginHandler: 0x7f9be863d450, appID: 811449395585015, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x7f9be8554390>, expirationDate: 2015-01-23 09:55:49 +0000, refreshDate: 2014-11-25 08:53:50 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:(
    "public_profile",
    "basic_info",
    email,
    "contact_email",
    "user_friends"
)>, com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 10;
            message = "(#10) To use taggable_friends on behalf of people who are not admins, developers and testers of your app, your use of this endpoint must be reviewed and approved by Facebook. To submit this feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review";
            type = OAuthException;
        };
    };
    code = 400;
    headers =     (
                {
            name = Expires;
            value = "Sat, 01 Jan 2000 00:00:00 GMT";
        },
                {
            name = "Cache-Control";
            value = "no-store";
        },
                {
            name = "Access-Control-Allow-Origin";
            value = "*";
        },
                {
            name = Pragma;
            value = "no-cache";
        },
                {
            name = "Content-Type";
            value = "text/javascript; charset=UTF-8";
        },
                {
            name = "Facebook-API-Version";
            value = "v2.2";
        },
                {
            name = "WWW-Authenticate";
            value = "OAuth \"Facebook Platform\" \"invalid_request\" \"(#10) To use taggable_friends on behalf of people who are not admins, developers and testers of your app, your use of this endpoint must be reviewed and approved by Facebook. To submit this feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review\"";
        }
    );
}}
抱歉长记录,但我想确保你得到所有信息,这样可以帮助我找到原因。任何帮助都会受到欢迎。

修改

我可以使用其他Facebook帐户获取上述朋友列表,但在此之前,我需要在Facebook开发者页面上添加特定帐户作为测试人员,以便我可以使用这些帐户登录然后获取朋友列表。现在我有一个问题,当我公开我的应用程序时,它不会有用,因为我不能在我的配置应用程序上添加数百名用户作为测试人员,而事件我不知道人的Facebook帐户将使用我的应用程序。所以,我需要提交我的应用程序以供Facebook审核,然后其他用户可以在他们使用我的应用程序时登录并获取朋友列表(在Facebook Developer上我的应用程序中没有配置这些用户作为测试人员页)?或者有另一种方法来解决这个问题?请帮我明白这一点。非常感谢!

2 个答案:

答案 0 :(得分:0)

我的应用程序遇到了同样的问题。我几次将它提交给Facebook。但似乎这种授权只能用于在故事中标记朋友。如果您因任何其他原因尝试检索用户的完整好友列表,Facebook将不会批准您的应用,您只能使用您设置的帐户访问朋友来测试应用。 希望它有所帮助...

答案 1 :(得分:0)

我希望这些信息有所帮助:

  

代表非管理员的人使用taggable_friends,   您的应用的开发人员和测试人员必须使用此端点   由Facebook审核并批准。提交此功能以供审核   请阅读我们关于可审查功能的文档:   https://developers.facebook.com/docs/apps/review