我想在 Facebook 上发布一个 Open Graph Fitness:runs 操作,并希望它使用我的路径图呈现。路径由下面的路径坐标定义。我该怎么做呢?下面的方法发布了操作,我可以在 Facebook 上的活动日志和时间轴中看到操作的文本。但是当我将鼠标悬停在已发布操作的任何元素上时,我看不到地图。我究竟做错了什么?
- (void) fbPost:(NSString *)txt toList:(NSString *)listId { // post
[FBSession setActiveSession:[FacebookManager instance].facebook.session];
NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
action[@"course"] = @"http://samples.ogp.me/48586838281818";
action[@"privacy"] = privacyStr;
NSMutableArray *coords = [NSMutableArray arrayWithCapacity:59];
for (int i = 0; i < 59; i++)
{
NSMutableDictionary *coord = [[NSMutableDictionary alloc] initWithCapacity:3];
#define TIMESTAMP @"fitness:metrics:timestamp"
#define LATITUDE @"fitness:metrics:location:latitude"
#define LONGITUDE @"fitness:metrics:location:longitude"
[coord setValue:[NSString stringWithFormat:@"2013-04-01T12:%2d:00+0000", i] forKey:TIMESTAMP];
[coord setValue:[NSString stringWithFormat:@"%f", 37.442564 + i * 0.00001] forKey:LATITUDE];
[coord setValue:[NSString stringWithFormat:@"%f", -122.164879 + i * 0.000001] forKey:LONGITUDE];
[coords addObject:coord];
NSLog(@"coord=%@ i=%d", coord, i);
}
action[@"path"] = [coords JSONString];
action[@"message"] = txt;
[FBRequestConnection startForPostWithGraphPath:@"me/fitness.runs"
graphObject:action
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if (!error) // it's a post, save id
{
}
else
{
}
}];
}