App.reload crashes the app

If I make a change in a document (say a user watched a video and I update the "views" counter), I'd like to update the TVML element showing the counter number somewhere in the previous document in NavigationDocument or a separate MenuBarDocument.


For this, one option is to try to reload the entire app, to rewrite the cache. Preferably, I'd add the "reloadData" parameter, to restart the app in its current state (btw, how can reloadData be implemented in the code below?). High resource eater, but still... "App.reload" crashes the app with this error:


The operation couldn't be completed. (TVMLKitErrorDomain error 3.)


Xcode logs this in its console:

appController(_:didFailWithError:) invoked with error: Error Domain=TVMLKitErrorDomain Code=3 "(null)"


And the Safari simulator console crashes / closes by itself.


App.onLaunch = function(options) {   
    var originalOptions = options; // retain the original app launch options, to use later for reload
    ...
}

var appReload = function() {
    App.reload(originalOptions); // this crashes the app
}

App.reload would clear the navigation stack and reload the JavaScript. You should only do that when you want to deploy the new JavaScript for your app.


It would help if you can share an example of what you are trying to do. You can access DOM and modify existing elements or add/remove elements, and your changes would be reflected in the UI. You don't need to reload the app for that.

@Nurinder M: The first page of the menuBar loads when my app first starts (standard). But if the user turns Apple TV off or if they use other apps and return to my app the next day or so, what do I do if I want to update the first page with new content dynamically? What can trigger reloading the first page after a user returns to my app?


And if I want to deploy new JS to my app, how do I use App.reload() without crashing the app?


I plan to update my "Presenter.js" quite often, how can I safely refresh the app's JS?

App.reload crashes the app
 
 
Q