1

我的请求:

<FBRequestConnection: 0x93a8ba0, 1 request(s):(
<FBRequest: 0x9395c90, session: 0xa8aeb80, graphPath: https://graph.facebook.com/me, HTTPMethod: GET, parameters:
{
   "access_token" = BAAG4P63ZBHK0BAObimWrMZCGOzn3s6qOtqynyzkJmIN0fKiKGlCkmlqlKMcpbvrrhN9QJsIxrTc7PZCFoceuCwAC2ygCph27WV72iwxkbi2svKCDemDo8BBqOwc6bp6DQH7U9tjp4gZBofb4brYg;
   fields = name;
   format = json;
   "migration_bundle" = "fbsdk:20120913";
   sdk = ios;
})>

我的回复:

result (null)
error Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x93b1ad0 {com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 100;
            message = "(#100) Unknown fields: name.";
            type = OAuthException;
        };
    };
    code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}

背后的原因是什么?如果我发送没有字段 = 名称;然后我取回一些默认用户数据。


调用:

FBRequest *graphRequest = [[FBRequest alloc] initWithSession:[FBSession activeSession]
                                                   graphPath:request.graphPath
                                                  parameters:request.parameters
                                                  HTTPMethod:request.httpMethod];

FBRequestConnection *connection = [[FBRequestConnection alloc] init];
[connection addRequest:graphRequest
     completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
 {
     [self requestCompleted:connection result:result error:error];
 }];
[connection start];

请求对象:

-(NSString*)graphPath
{ return @"https://graph.facebook.com/me"; }

-(NSDictionary*)parameters
{
    return [NSDictionary dictionaryWithObjectsAndKeys:
            @"name", @"fields",
            nil];
}

-(NSString*)HTTPMethod
{
    return @"GET";
}

也尝试过使用固定参数,但没有效果:

graphRequest = [[FBRequest alloc] initWithSession:[FBSession activeSession]
                                        graphPath:@"https://graph.facebook.com/me"
                                       parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"name", @"fields", nil]
                                       HTTPMethod:@"GET"];
4

1 回答 1

2

图形路径必须是相对的。现在我只使用@“me”而不是@“https://graph.facebook.com/me”,并且像魅力一样工作。

于 2012-11-08T10:35:38.823 回答