2015-05-08 58 views
3

我想從我的iOS應用程序共享fb上正在運行的活動。使用地圖創建開放式圖表故事 - iOS

 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應用fb帖子中相同)。我如何添加更多的數據點到圖形對象。

回答

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

+0

嗨達倫,我想this.But它只顯示起點。 https://developers.facebook.com/docs/opengraph/guides/fitness 在這個我想完成'處理大型課程對象'。但我無法想出它以iOS的方式做到這一點 – dileepa88