新しいクライアント サーバー tvOS アプリの作成中に、tvOS が外部tvml
ファイルからデータを取得しません。これはエラーです:ITML <Error>: Failed to load launch URL with error: (null)
これがmain.js
コードです
function getDocument(url) {
var templateXHR = new XMLHttpRequest();
templateXHR.responseType = "document";
templateXHR.addEventListener("load", function() {pushDoc(templateXHR.responseXML);}, false);
templateXHR.open("GET", url, true);
templateXHR.send();
return templateXHR;
}
function pushDoc(document) {
navigationDocument.pushDocument(document);
}
App.onLaunch = function(options) {
var templateURL = 'niclasblog.com/appletv/main.tvml';
getDocument(templateURL);
}
App.onExit = function() {
console.log('App finished');
}
そして、私もmain.tvml
ファイルを添付しました
<document>
<alertTemplate>
<title>Test</title>
<description>This is a test</description>
<button>
<text>Yes</text>
</button>
<button>
<text>No</text>
</button>
</alertTemplate>
</document>
このコードは Apple ドキュメントから直接引用したものなので、なぜ機能しないのかわかりません。