FYI: Couchbase Lite on tvOS (AppleTV)

35 views
Skip to first unread message

Jens Alfke

unread,
Sep 23, 2015, 3:19:58 PM9/23/15
to Couchbase Mobile
Couchbase HQ received a dev unit of the new AppleTV, and I’ve been testing it out a bit. Here’s what I’ve found:

  • For development purposes, you can use the iOS Couchbase Lite framework in tvOS apps, since tvOS is mostly the same as iOS. But you’ll get a linker warning complaining that it’s not a “real” tvOS binary. In the near future we’ll release a build that’s been officially compiled for tvOS.
  • AppleTV apps cannot write to the Application Support directory, only the Caches directory. You’ll need to instantiate the CBLManager with a custom path pointing to that directory, otherwise it’ll fail when trying to create a database. (In the upcoming official build, I’m putting in an #ifdef to have CBLManager default to the Caches directory.)
  • Good news: the Caches directory seems more persistent than Apple’s docs imply. I’ve run a simple app that creates a database there, and the database persists across app launches and across device restarts. I suspect it will get dumped when storage fills up, but I haven’t tested this yet.

So as far as I can tell, Couchbase Lite will work great on AppleTV … your app just has to be prepared to lose its local databases. (They’ll never be deleted while it’s running, though.) 

Some general advice:
— Try to avoid quitting with un-pushed local changes, because they might be lost. There’s nothing you can do to stop the user from switching apps, but you can highlight the fact that data hasn’t synced yet. You can also ask for more time when the app gets deactivated, and keep the replicator from suspending when in the background.
— Consider using several channels, with one containing just the essential documents you need to display the initial UI. That will speed up the first launch, and also any launch after the local storage has been purged. After that content is synced you can then pull other channels with more data.

—Jens
Reply all
Reply to author
Forward
0 new messages