我想用OpenGraph API创建一个fitness.course对象,以便以后在fitness.runs动作中使用。当尝试使用Facebook Open Graph参考页面中的代码示例创建一个时,我收到以下错误:" HTTPStatusCode:400,参数对象是必需的"。我无法确定意味着哪个参数,所有必填字段都已设置。
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Sample Metrics: Speed: Value", @"fitness:metrics:speed:value",
@"Sample Course", @"og:title",
@"Sample Metrics: Custom-Unit Energy: Value", @"fitness:metrics:custom_unit_energy:value",
@"Sample Distance: Value", @"fitness:distance:value",
@"fitness.course", @"og:type",
@"Sample Speed: Units", @"fitness:speed:units",
@"Sample Metrics: Speed: Units", @"fitness:metrics:speed:units",
@"Sample Distance: Units", @"fitness:distance:units",
@"574731755910387", @"fb:app_id",
@"Sample Total Custom-Unit Energy: Value", @"fitness:custom_unit_energy:value",
@"Put your own URL to the object here", @"og:url",
@"Sample Metrics: Custom-Unit Energy: Units", @"fitness:metrics:custom_unit_energy:units",
@"Sample Metrics: Pace: Units", @"fitness:metrics:pace:units",
@"Sample Metrics: Distance: Units", @"fitness:metrics:distance:units",
@"Sample Splits: Values: Units", @"fitness:splits:values:units",
@"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png", @"og:image",
@"Sample Pace: Units", @"fitness:pace:units",
@"Sample Metrics: Location: Latitude", @"fitness:metrics:location:latitude",
@"Sample Duration: Units", @"fitness:duration:units",
@"Sample Pace: Value", @"fitness:pace:value",
@"Sample Duration: Value", @"fitness:duration:value",
@"Sample Metrics: Pace: Value", @"fitness:metrics:pace:value",
@"Sample Speed: Value", @"fitness:speed:value",
@"Sample Splits: Values: Value", @"fitness:splits:values:value",
@"Sample Metrics: Location: Longitude", @"fitness:metrics:location:longitude",
@"Sample Total Custom-Unit Energy: Units", @"fitness:custom_unit_energy:units",
@"Sample Metrics: Distance: Value", @"fitness:metrics:distance:value",
nil
];
/* make the API call */
[FBRequestConnection startWithGraphPath:@"/me/objects/fitness.course"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
/* handle the result */
if(error)
{
UIAlertView* alert = [[UIAlertView alloc]initWithTitle:@"Error" message:error.description delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
else
{
UIAlertView* alert = [[UIAlertView alloc]initWithTitle:@"Success" message:@"Message successfully posted !" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}];