Start a new topic

Offline Caching not working..

So, I have this problem when I enable offline caching for fetching data from Kinvey, and I get one of these two errors when I go offline:

error #1

Error Domain=KinveyError Code=406 "Kinvey requires application/json as the Content-Type of the response" UserInfo={NSLocalizedDescription=Kinvey requires application/jsonas the Content-Type of the response, NSLocalizedFailureReason=Kinvey requires application/json as the Content-Type of the response}

error #2

Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={NSErrorFailingURLStringKey=https://kinvey.url, NSErrorFailingURLKey=https://anotherkinvey.url, _kCFStreamErrorDomainKey=12, NSLocalizedDescription=The Internet connection appears to be offline., KinveyKit.HTTPMethod=GET, NSUnderlyingError=0x7f8c26418e20 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, _kCFStreamErrorCodeKey=8}

I tried all sorts of cache policies provided by Kinvey, but nothing worked..

Here is how I enabled caching for my Kinvey store: 

KCSCachedStore *store = [KCSCachedStore storeWithCollection:collection options:@{KCSStoreKeyCachePolicy : @(KCSCachePolicyNetworkFirst)}];



Daniel,

Did my suggestion help?

Thanks,
Pranav
Kinvey Support

 

Daniel,

Please take a look at the Statusshare sample that implements caching:
http://devcenter.kinvey.com/ios/samples/statusshare

Also can you please ensure that you are using the latest SDK (1.40.8) version.

Thanks,
Pranav
Kinvey Support

 

Login or Signup to post a comment