Calling iOS CBLManager internalURL with NSURLSession


#1

In iOS it appears calls to the URL provided by the CBLManager or the CBLDatabase object’s internalURL property only succeed when called with methods from the old NSURLConnection class. This class has been largely replaced by NSURLSession, and now in iOS9 we’re starting to see some NSURLConnection methods be deprecated.

Will Couchbase Lite support calling internalURL URLs with NSURLSession anytime soon? or should it now?
Thanks


#2

As far as I know, protocol handlers registered with NSURLProtocol should work with NSURLSession. Are you saying they don’t?

Also, if you’re writing a native app it’s preferable to use the native Couchbase Lite API. The internal REST API is provided mostly for PhoneGap-type applications.

We know that NSURLProtocol handlers don’t work with XMLHTTPRequests called from scripts running in WKWebViews — this is because the view runs in a separate sandboxed process. We’re investigating workarounds to that.


#3

ok, good to know NSURLSession should work. I was having trouble getting it to work, and found NSURLConnection did work, so I thought NSURLSession wasn’t supported for some reason. I just wrote a small test app, and sure enough NSURLSession works fine… The issue must have been something else in my code.

As far as using the REST interface from native iOS. We use the native CBL API, but we havea particular use case where we want to call the REST interface from native code. It’s kind of an odd proxy situation, where a request is coming from a web view, being massaged in iOS, then passing off to CBL.

Thanks for your help!


#4

Whew! Thanks for confirming. I’m already worried about what we can do to support WKWebView, so it’s good to know there isn’t another upcoming headache with NSURLSession :confused: