2012-11-07 28 views
1

我的要求:Facebook API:未知字段:名稱?

<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} 

背後是什麼原因? 如果我發送時沒有fields = name;然後我找回一些默認的用戶數據。


調用:

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]; 

Request對象:

-(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"]; 
+0

您可以共享記錄此請求/響應的原始請求的代碼嗎? –

+0

實際上是一個啓動了FBRequestConnection的FBRequest代碼,裏面有上面的參數。 – Geri

+0

你有沒有想法? – Geri

回答

2

圖路徑必須是相對的。 現在我只使用@「我」而不是@「https://graph.facebook.com/me」,並且像魅力一樣工作。