Posts

Post not yet marked as solved
0 Replies
818 Views
I'm trying to use URLRequest.CachePolicy.useProtocolCachePolicy in my watch extension, but every request fails with 'can’t load from network' error.I have seen the below answer from StackOverflow:NSURLErrorDomain Code=-2000 "can’t load from network"but what I want to do is use cached if valid or request policy. The best fit is to use reloadRevalidatingCacheData but it hasn't been implemented.@constant NSURLRequestReloadRevalidatingCacheData Specifies that the existing cache data may be used provided the origin source confirms its validity, otherwise the URL is loaded from the origin source. Unimplemented.In iOS, the useProtocolCachePolicy works very similarly with reloadRevalidatingCacheData.https://developer.apple.com/documentation/foundation/nsurlrequest/cachepolicy/useprotocolcachepolicyHowever the requests fail in watchOS with useProtocolCachePolicy policy. It worked with reloadIgnoringLocalCacheData by the way. I'm not making HTTP or HTTPS byte-range request, so it seems like useProtocolCachePolicy work as iOS does, but it doesn't.The only way seems to implement caching manually, but I want to know why it doesn't work and there is any out-of-box option for this issue. Or does Apple have any plan to implement `reloadRevalidatingCacheData` option?
Posted
by rrhan.
Last updated
.