You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using Nuke to load images in my app. I recently added a notification service extension which serves to load images and attach them to incoming remote notifications. Both the app and the notification service extension are in the same app group. I figured it would be nice if they could share the same disk cache to avoid downloading/processing the same images twice. So in both my app and notification service extension I setup a pipeline that points to the app group directory:
var configuration = ImagePipeline.Configuration()
configuration.dataLoader = {
let config = URLSessionConfiguration.default
config.urlCache = nil
return DataLoader(configuration: config)
}()
configuration.dataCache = {
guard let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: AppGroupIdentifier) else {
Log.error("Failed to initialize image pipeline data cache: Could not locate container URL")
return nil
}
let dataCachePath = containerURL.appendingPathComponent(ImageDataCacheName, isDirectory: true)
return try? DataCache(path: dataCachePath)
}()
My estimation is that this is fine, but I'm wondering if there are any risks associated with doing this. Is there some chance of a crash due to the extension and the app attempting to write to the same spot? I'm guessing no given that I don't show notifications while the app is in the foreground (which is when the app image pipeline would be active). Basically I just wanted to get some feedback regarding whether this approach is reasonable or not. Thank you.
The text was updated successfully, but these errors were encountered:
Hello, I'm using Nuke to load images in my app. I recently added a notification service extension which serves to load images and attach them to incoming remote notifications. Both the app and the notification service extension are in the same app group. I figured it would be nice if they could share the same disk cache to avoid downloading/processing the same images twice. So in both my app and notification service extension I setup a pipeline that points to the app group directory:
My estimation is that this is fine, but I'm wondering if there are any risks associated with doing this. Is there some chance of a crash due to the extension and the app attempting to write to the same spot? I'm guessing no given that I don't show notifications while the app is in the foreground (which is when the app image pipeline would be active). Basically I just wanted to get some feedback regarding whether this approach is reasonable or not. Thank you.
The text was updated successfully, but these errors were encountered: