Posts

Post not yet marked as solved
4 Replies
1.5k Views
In our tvOS app we have a couple of hooks into the native side where we receive events over a WebSocket in (using CocoaAsyncSocket) native and propagate those events into the JavaScript layer. The calls into the JS layer are structured like this:self.receiveQueue.addOperation { websocket.invokeMethod("onmessage", withArguments: [["data": text]]) }Where `receiveQueue` is an `OperationQueue`. This works great most of the time, but we occasionally see application crashes where it seems a memory reference has gone bad. However, we've found that if we take the JavaScript function being called and wrap it in asetTimeout(() => { // Do the work here }, 0)this resolves nearly all the issues. We still get an application crash here and there but the `setTimeout` does the trick most of the time.This leads me to the following question. What's the proper way to call back to a TVJS application from native? Should I be using DispatchQueue.main.async { } instead of an OperationQueue? How does this relate to doing work on the main UI thread?Thanks!
Posted
by coreyjv.
Last updated
.
Post not yet marked as solved
0 Replies
476 Views
I have an app with a Top Shelf Extension that uses a UserDefaults(suiteName: "app-group-name") to share data between the main app and the extension. I recently enabled the "Run as Current User" capability for both the app itself and the extension. My expectation was that the Top Shelf content would change when the user changes in tvOS but this is not the case. What changes are required such that the Top Shelf content can be changed by tvOS user?
Posted
by coreyjv.
Last updated
.
Post not yet marked as solved
0 Replies
396 Views
Can anyone provide an example on how the DataSource API can be used? https://developer.apple.com/documentation/tvmljs/datasource?changes=latest_minorIt was added in tvOS 13 but the example in the docs (Binding JSON Data to TVML Documents) wasn't updated to use it.
Posted
by coreyjv.
Last updated
.