【发布时间】:2017-08-18 14:38:20
【问题描述】:
我的 URLCache 在 Xcode 模拟器中缓存 URL,但不在真实设备上。我将代码缩小到这个例子:
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是什么?
标签: ios xcode afnetworking alamofire