Ios 如何在不使用降价的情况下使用Apple新闻格式中的链接添加(超链接)?

Ios 如何在不使用降价的情况下使用Apple新闻格式中的链接添加(超链接)?,ios,json,format,apple-news,Ios,Json,Format,Apple News,我知道,通过执行以下操作,可以使用markdown在Apple新闻格式的文章中包含超链接: { "version": "1.0", "identifier": "sketchyTech_Demo", "title": "My First Article", "language": "en", "layout": {}, "components": [ { "role": "title",

我知道,通过执行以下操作,可以使用markdown在Apple新闻格式的文章中包含超链接:

{
    "version": "1.0",
    "identifier": "sketchyTech_Demo",
    "title": "My First Article",
    "language": "en",
    "layout": {},
    "components": [
        {
            "role": "title",
            "text": "My First Article",
            "textStyle": "titleStyle"
        },
        {
            "role": "body",
            "format": "markdown",
            "text": "Here's a [hyperlink](http://sketchytech.blogspot.co.uk).",
            "textStyle": "bodyStyle"
        }
    ],
    "componentTextStyles": {
        "titleStyle": {
            "textAlignment": "center",
            "fontName": "HelveticaNeue-Bold",
            "fontSize": 64,
            "lineHeight": 74,
            "textColor": "#000"
        },
        "bodyStyle": {
            "textAlignment": "left",
            "fontName": "Georgia",
            "fontSize": 18,
            "lineHeight": 26,
            "textColor": "#000"
        }
    }
}
但在苹果新闻格式中,还有一种类型,我认为它应该以类似的方式工作,它被放置在如下组件中:

    {
        "role": "title",
        "text": "My First Article",
        "textStyle": "titleStyle",
        "inlineTextStyles": [{
            "rangeStart": 3,
            "rangeLength": 5,
            "textStyle": {
                "textColor": "#FF00007F"
            }
        }
    }
Apple提供了示例代码:

{
  "type": "link",
  "URL": "http://www.apple.com",
  "rangeStart": 0,
  "rangeLength": 20
}
但是它没有像其他元素那样给出任何关于它应该放置在哪里的指示。它还有一个与其他元素不同的“类型”键,这也相当神秘。不仅如此,在类型描述中,它还被描述为全大写的
LinkAddition
。我尝试过各种组合,我想最明显的是

"linkAdditions": [{
  "type": "link",
  "URL": "http://www.apple.com",
  "rangeStart": 0,
  "rangeLength": 20
}]
以与
inlineTextStyles
相同的方式添加到组件中(因为一个文本块可以有多个链接,就像它可以有多个样式一样),但我无法获得这个或我尝试使用的任何变体。是否新闻预览版还不能呈现此内容?

将其添加到“additions”属性下,而不是您所期望的组件内部的“linkAdditions”下

例如,这应该起作用:

...

"role": "body",
"text": "Article text goes here and here",
"additions": [{
  "type": "link",
  "URL": "http://www.apple.com",
  "rangeStart": 0,
  "rangeLength": 20
}],

...
注意:如果格式是markdown,它将忽略additions属性