【问题标题】:tvml syntax error : Unexpected token '<'tvml 语法错误:意外的标记 '<'
【发布时间】:2016-08-28 06:39:23
【问题描述】:

尝试在模拟器上运行 Apple tv 应用程序时出现以下错误:

2016-08-27 23:38:46.139 appleTV_Sample[11498:5282178] ITML : SyntaxError: Unexpected token '<'...{
line = 1;
sourceURL = "http://localhost:9001//application.js";
}
appController(_:didFailWithError:) invoked with error: Error Domain=TVMLKitErrorDomain Code=3 "(null)"

以下是我在 js 文件中使用的代码:

var alertString = `<?xml version="1.0" encoding="UTF-8" ?>
  <document>
    <alertTemplate>
      <title>${title}</title>
      <description>${description}</description>
      <button>
        <text>OK</text>
      </button>
    </alertTemplate>
  </document>`

感谢您提供任何解决此问题的建议。

【问题讨论】:

  • 第 1 行出现语法错误。 SyntaxError: Unexpected token '

标签: tvos tvml


【解决方案1】:

我的解决方案不是最好的,但至少它可以让你编译代码:

var alertString = "<?xml version='1.0' encoding='UTF-8' ?>" +
"<document>" +
"<alertTemplate>" +
"<title>${title}</title>" +
"<description>${description}</description>" +
"<button>" +
"<text>OK</text>" +
"</button>" +
"</alertTemplate>" +
"</document>";

【讨论】:

    【解决方案2】:

    检查此行sourceURL = "http://localhost:9001//application.js" 你有两个斜线

    【讨论】:

      猜你喜欢
      • 2013-09-04
      • 1970-01-01
      • 1970-01-01
      • 2015-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-03
      相关资源
      最近更新 更多