使用地图创建开放式图形故事 - iOS

时间:2015-05-08 03:59:10

标签: ios facebook

我想从我的iOS应用程序分享fb上的运行活动。

     NSDictionary *properties = @{
                               @"og:type": @"fitness.course",
                               @"og:title": @"Sample Course",
                               @"og:description": @"This is a sample course.",
                               @"fitness:duration:value": @100,
                               @"fitness:duration:units": @"s",
                               @"fitness:distance:value": @5,
                               @"fitness:distance:units": @"km",
                               @"fitness:speed:value": @5,
                               @"fitness:speed:units": @"m/s",


                               @"fitness:metrics:location:latitude": @37.416382,
                               @"fitness:metrics:location:longitude": @-122.152659,
                               @"fitness:metrics:location:altitude" :@42,
                               @"fitness:metrics:timestamp" :@"2011-01-26T00:00",
                               @"fitness:metrics:distance:value" :@0,
                               @"fitness:metrics:distance:units":@"mi" ,
                               @"fitness:metrics:pace:value" :@0,
                               @"fitness:metrics:pace:units" :@"s/m",
                               @"fitness:metrics:calories":@0,

                               };
  FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
  FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
  action.actionType = @"fitness.runs";
  [action setObject:object forKey:@"fitness:course"];
  FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
  content.action = action;
  content.previewPropertyName = @"fitness:course";

我可以使用此功能分享fb上的活动。但现在我想在fb帖子的地图视图中添加地理点(与Nike app fb帖子相同)。如何向图形对象添加更多数据点。

1 个答案:

答案 0 :(得分:0)

如果您想添加更多积分,请按顺序添加。

NSDictionary *properties = @{
                           @"og:type": @"fitness.course",
                           @"og:title": @"Sample Course",
                           @"og:description": @"This is a sample course.",
                           @"fitness:duration:value": @100,
                           @"fitness:duration:units": @"s",
                           @"fitness:distance:value": @5,
                           @"fitness:distance:units": @"km",
                           @"fitness:speed:value": @5,
                           @"fitness:speed:units": @"m/s",


                           @"fitness:metrics:location:latitude": @37.416382,
                           @"fitness:metrics:location:longitude": @-122.152659,
                           @"fitness:metrics:location:altitude" :@42,
//Enter point 2
                           @"fitness:metrics:location:latitude": @xx.xxx,
                           @"fitness:metrics:location:longitude": @-xxx.xxx,
                           @"fitness:metrics:location:altitude" :@xx,
//Enter point 3, 4, 5 ...
... ...
                           @"fitness:metrics:timestamp" :@"2011-01-26T00:00",
                           @"fitness:metrics:distance:value" :@0,
                           @"fitness:metrics:distance:units":@"mi" ,
                           @"fitness:metrics:pace:value" :@0,
                           @"fitness:metrics:pace:units" :@"s/m",
                           @"fitness:metrics:calories":@0,

                           };

https://developers.facebook.com/docs/reference/opengraph/object-type/place