I received the new Apple TV that allows developers to make apps on it. So I tried to make my company’s iOS app (that uses couchbase lite ios and CBLIncrementalStore) run on it.
In the simulator (same as iOS simulator), it works fine, but when I ran on the actual device, the Apple TV, the app crashes at launch.
Then I figured out that a tvOS app can’t actually write to disk (sqlite). Instead, iit needs to use CloudKit… :’(
Would it be possible to use CBLIncrementalStore in memory only ?
Thanks : -)
We just received our dev kit Friday and haven’t had a chance to test with it yet.
My understanding is that apps can write to disk, but that their files may be deleted at any time after the app quits, to free up space. So I don’t think the crash is due to that. Have you looked at the backtrace?
The error I have is when the Core Data Stack is set up:
2015-09-20 20:54:38.902 tivi[300:112091] ERROR : NO ERRORS Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “tivi” in the folder “Application Support”." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9EEA69DB-380D-4DCD-B67E-C75F163EE443/Library/Application Support/tivi, NSUnderlyingError=0x1576b85c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Oh, interesting. Let me know how that works. (This is making me really glad we got a dev kit! I figured there’d be some issues like this. In the next release we can check for tvOS and put the default database location in Caches.)
Well, that’s weird. You could try adding a bit of test code to try writing a file to various directories, just using simple methods like +[NSData writeToPath:].
Our dev unit arrived, so I’ll be setting it up today and hopefully trying some stuff out like the above.
Cool. I’ve got my AppleTV set up and Xcode 7.1 installed, and I’m setting up the Couchbase Lite project to build for tvOS. Our of curiosity: What did you do to build a tvOS version of Couchbase Lite? I’m having to make a lot of changes — creating new targets, changing dependencies, etc. — and I wonder if you had to do all that too or if you found a simpler way to retarget that I don’t know about (:
Hmmm strange. I didn’t rebuild couchbase lite actually, I took the framework as is. In my project i added -ObjC in other linker flag, I don’t know if it’s related…
Ah, I just looked again at my project and I have lots of warnings like this
warning: URGENT: building for tvOS simulator, but linking in object file (/Users/florion/Downloads/aaa/tivi/tivi/Vendor/External/CouchbaseLite.framework/CouchbaseLite(BLIPHTTPLogic.o)) built for iOS. Note: This will be an error in the future.
I didn’t really care since since was just to make a quick a dirty prototype :- )