我想在 Facebook 上发布一个 Open Graph fitness:walk Action ,我希望它用我的路径图呈现。我该怎么做呢?下面的方法发布了操作,我可以在我的 Facebook 事件日志和时间轴中看到操作的文本。但是当我将鼠标悬停在已发布操作的任何元素上时,我没有看到 map 。我做错了什么?
NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];action[@"course"] = @"http://samples.ogp.me/136756249803614";
[FBRequestConnection startForPostWithGraphPath:@"me/fitness.walks"
graphObject:action
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
// handle the result
NSLog(@"error:%@",error.description);
NSLog(@"Result:%@",result);
}];
最佳答案
试试这个
[FBRequestConnection startForPostWithGraphPath:[NSString stringWithFormat:@"me/fitness.%@?access_token=%@",walkType,appDelegate.session.accessTokenData.accessToken]
graphObject:action
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
// handle the result
//NSLog(@"error description:%@",error);
NSLog(@"Result:%@",result);
[SVProgressHUD dismiss];
if (error == nil)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Track My Walks" message:[NSString stringWithFormat:@"You successfully post a route and your id is:%@",[result valueForKey:@"id"]] delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[alert show];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Track My Walks" message:error.description delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[alert show];
}
}];
}];
[request setFailedBlock:^{
[SVProgressHUD dismiss];
NSError *error = [request error];
NSLog(@"Error: %@", error.localizedDescription);
[self directionsDidFailedDirections:error.localizedDescription];
}];
[request startAsynchronous];
关于iphone - 如何使用 Facebook Open graph api for fitness 步行通过 FacebookSDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16186051/