From 02edc665efda72b3d81aa42239810f1d9c2f20b0 Mon Sep 17 00:00:00 2001 From: William Reiske Date: Fri, 29 Jan 2021 04:12:16 -0700 Subject: [PATCH] Don't cache manifest.json on iOS to prevent stuck updates This change ensures that manifest.json does not get cached locally on the device for any extended period of time. --- src/ios/AssetBundleManager.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ios/AssetBundleManager.swift b/src/ios/AssetBundleManager.swift index ed895d3..5e72dde 100644 --- a/src/ios/AssetBundleManager.swift +++ b/src/ios/AssetBundleManager.swift @@ -47,10 +47,12 @@ final class AssetBundleManager: AssetBundleDownloaderDelegate { operationQueue.maxConcurrentOperationCount = 1 operationQueue.underlyingQueue = queue - // We use a separate to download the manifest, so we can use caching - // (which we disable for the session we use to download the other files - // in AssetBundleDownloader) - session = URLSession(configuration: URLSessionConfiguration.default, delegate: nil, delegateQueue: operationQueue) + // An ephemeral session configuration object is similar to a default session configuration, + // except that the corresponding session object doesn’t store caches, credential stores, + // or any session-related data to disk. Instead, session-related data is stored in RAM. + + // Setting this to ephemeral makes sure that manifest.json is never cached locally. + session = URLSession(configuration: URLSessionConfiguration.ephemeral, delegate: nil, delegateQueue: operationQueue) } deinit {