TVML + JavaScript does not accept relative URLs

Originator:jbrayton
Number:rdar://22775126 Date Originated:2015-09-20
Status:Closed Resolved:"There are no plans to address this."
Product:tvOS pre-release Product Version:Xcode Version 7.1 beta (7B60)
Classification:enhancement Reproducible:always
 
Summary:
TVML development would be dramatically easier if it accepted relative URLs, but it does not seem to.

The sample code at the URL below includes the concept of a "BASEURL", which is substituted at the client side by the app. That does the job, but it would be easier if the JavaScript could reference resources relative to the root level of the server or relative to the JavaScript file. 

https://developer.apple.com/library/prerelease/tvos/samplecode/TVMLCatalog/Introduction/Intro.html

Steps to Reproduce:
1.  Download and run the sample code at:

https://developer.apple.com/library/prerelease/tvos/samplecode/TVMLCatalog/Introduction/Intro.html

2.  Observe that it works as expected.

3.  Change line 26 of client/js/application.js to `/js/ResourceLoader.js`.

Expected Results:
The app would still work.

Actual Results:
I get this error, presumably because tvOS does not know where it should find "/js/ResourceLoader.js".

2015-09-20 18:31:59.111 TVMLCatalog[34149:1013409] ITML <Error>: Failed to load launch URL with error: Error Domain=NSURLErrorDomain Code=-1004 "Cannot connect to localhost" UserInfo={NSUnderlyingError=0x7f986a80f110 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "Could not connect to the server." UserInfo={NSErrorFailingURLStringKey=http://localhost:9001/js/application.js, NSErrorFailingURLKey=http://localhost:9001/js/application.js, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1, NSLocalizedDescription=Could not connect to the server.}}, NSErrorFailingURLStringKey=http://localhost:9001/js/application.js, NSErrorFailingURLKey=http://localhost:9001/js/application.js, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Cannot connect to localhost}
appController(_:didFailWithError:) invoked with error: Error Domain=TVMLKitErrorDomain Code=3 "(null)"


Version:
Xcode Version 7.1 beta (7B60)


Configuration:
tvOS running in Xcode simulator

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!