我想在Facebook上發佈Open Graph fitness:runs操作,我希望它可以用我的路徑地圖進行渲染。路徑由下面的路徑座標定義。我該怎麼做呢?下面的方法發佈了該操作,我可以在我的Facebook上的活動日誌和時間軸中看到該操作的文本。但是,當我對發佈的操作的任何元素進行回顧時,我沒有看到地圖。我究竟做錯了什麼?如何使用iOS SDK發佈包含地圖的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
{
}
}];
}
你能解決這個讀?我也嘗試用座標發佈FB Graph動作。 –