图谱API - 有差距的课程

时间:2017-04-18 11:49:17

标签: facebook facebook-opengraph opengraph

我目前正在创建课程对象并取得成功。然而,我的观点并不是持续的(我知道差距在哪里)。将数据上传到Facebook时,所有点都会自动链接,从而产生错误的曲目图。是否可以在开放图形api中创建一个具有特定点之间指定间隙的课程?

    let track = MyTrack()
    var properties = [String : Any]()

    properties["og:type"] = "fitness.course"
    properties["og:title"] = "MyTitle"
    properties["og:description"] = "MyDesc"

    properties["fitness:distance:value"] = track.totalDistance.kmRounded()
    properties["fitness:distance:units"] = "km"
    properties["fitness:duration:value"] = track.totalTime
    properties["fitness:duration:units"] = "s"
    properties["fitness:speed:value"] = track.averageSpeed()
    properties["fitness:speed:units"] = "m/s"

    //locationSamples is array of subArrays of points (points from subArrays are not to be linked after upload
    track.locationSamples.flatMap({ $0 }).enumerated().forEach({

                properties["fitness:metrics[\($0)]:location:latitude"] = $1.coordinate.latitude
                properties["fitness:metrics[\($0)]:location:longitude"] = $1.coordinate.longitude
            })

    let object = FBSDKShareOpenGraphObject(properties: properties)
    let action = FBSDKShareOpenGraphAction()

    action.actionType = "fitness.bikes"
    action.setObject(object, forKey: "fitness:course")

    let content = FBSDKShareOpenGraphContent()

    content.action = action
    content.previewPropertyName = "fitness:course"

0 个答案:

没有答案