2017-08-18 10 views
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)) 
} 

私は非常に混乱しています。何か案は?

+0

「responseData」のサイズはどれくらいですか?あなたの 'urlCache'の' diskCapacity'と 'memoryCapacity'は何ですか? – Rob

答えて

0

このキャッシュは、他のネットワークコールによって生成され、領域が不足していました。私たちは、キャッシュのサイズを大幅に増やすことでそれを修正しました。

関連する問題