iOS:在Facebook上分享运行

时间:2016-01-25 13:45:26

标签: ios facebook facebook-opengraph facebook-ios-sdk

我正在尝试分享用户记录到Facebook的活动,但是无法弄清楚如何获得良好的GPS路线。

这是我到目前为止所拥有的。 我可以设置fitness:metrics:location:latitude/longitude并在Facebook上显示该地点的地图。但是我怎么能分享整个曲目呢?有没有办法只使用FBSDKShareAPI?

    let properties = [
        "og:type": "fitness.course",
        "og:title": "ShareAPI Test-Course",
        "og:description": "This is a sample course.",
        "fitness:duration:value": 100,
        "fitness:duration:units": "s",
        "fitness:distance:value": 13,
        "fitness:distance:units": "km",
        "fitness:speed:value": 5,
        "fitness:speed:units": "m/s",
        "fitness:metrics:location:latitude": "41.40338",
        "fitness:metrics:location:longitude": "2.17403"
    ]


    let object = FBSDKShareOpenGraphObject(properties: properties)

    let action = FBSDKShareOpenGraphAction()
    action.actionType = "fitness.runs"
    action.setObject(object, forKey: "fitness:course")

    let content = FBSDKShareOpenGraphContent()
    content.action = action
    content.previewPropertyName = "fitness:course"

    FBSDKShareAPI.shareWithContent(content, delegate: self)

我必须在哪里添加所有跟踪点([FitnessActivityDataPoint])?我对这些东西的文档感到有点沮丧,因为我没有真正得到它。

非常感谢任何帮助!

编辑:

如果我将指标包装为数组,它也无法正常工作:(

"fitness:metrics": [
            [
                "fitness:metrics:location:latitude": "41.40338",
                "fitness:metrics:location:longitude": "2.17403",
                "fitness:metrics:location:altitude": "1",
                "fitness:metrics:timestamp": "2011-01-26T00:00"
            ],
            [
                "fitness:metrics:location:latitude": "41.60338",
                "fitness:metrics:location:longitude": "2.12403",
                "fitness:metrics:location:altitude": "1",
                "fitness:metrics:timestamp": "2011-01-26T01:00"
            ],
            ...
        ],

0 个答案:

没有答案