0
URLCacheはURLをXcodeシミュレータにキャッシュしますが、実際のデバイスにはキャッシュしません。コードをこの例に絞りました:URLCacheはURLをXcodeシミュレータにキャッシュしますが、デバイスはありません
if let urlCache = SessionManager().session.configuration.urlCache {
// Returns nil, because there's nothing in the cache
print(urlCache.cachedResponse(for: urlRequest))
// Put the URL in the cache
urlCache.storeCachedResponse(CachedURLResponse(response: response, data: responseData), for: urlRequest)
// URL should now be in the cache, but it's still nil!
print(urlCache.cachedResponse(for: urlRequest))
}
私は非常に混乱しています。何か案は?
「responseData」のサイズはどれくらいですか?あなたの 'urlCache'の' diskCapacity'と 'memoryCapacity'は何ですか? – Rob