Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value of type 'SDImageCacheConfig' has no member 'SDImageCacheAvoidDecodeImage' #2837

Closed
3 tasks done
fruit-ninja opened this issue Sep 11, 2019 · 4 comments
Closed
3 tasks done
Labels

Comments

@fruit-ninja
Copy link

fruit-ninja commented Sep 11, 2019

New Issue Checklist

Issue Info

Info Value
Platform Name e.g. ios / macos / tvos / watchos
Platform Version e.g. 12.0 / 10.14.0 / 12.0 / 5.0
SDWebImage Version e.g. 5.0.0 / 4.4.0
Integration Method e.g. carthage / cocoapods / manually
Xcode Version e.g. Xcode 11 / Xcode 10
Repro rate e.g. all the time (100%) / sometimes x% / only once
Repro with our demo prj e.g. does it happen with our demo project?
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

Hey guys,

Would one of you kindly point me to where I can set:

SDImageCacheAvoidDecodeImage

I am currently setting it here: SDImageCache.shared.config.SDImageCacheAvoidDecodeImage

Thanks in advance!

@dreampiggy
Copy link
Contributor

This is one of SDImageCacheOptions enum, not the SDImageCacheConfig property.
See documentation: https://sdwebimage.github.io/Enums/SDImageCacheOptions.html#/c:@E@SDImageCacheOptions@SDImageCacheAvoidDecodeImage

@dreampiggy
Copy link
Contributor

dreampiggy commented Sep 11, 2019

If you use SDImageCache directly (not via SDWebImageManager or View Category method), you use the options in SDImageCache queryCacheOperationForKey:options:context:done.

If you want to use the correspond options in View Category method, use SDWebImageAvoidDecodeImage in options arg.

If you wanrt I want a global control for this option, maybe you can try the 5.1.0 feature's the Options Processor. See more the demo usage and background in #2719 and #2736

@fruit-ninja
Copy link
Author

Hey @dreampiggy Thank you for your prompt reply. So the main issue I am having is the devices running out of memory when I load all the images into a tableview. This is what I am trying to do with some of the advices I've seen online:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        SDImageCache.shared.config.maxDiskAge = 3600 * 24 * 7 //1 Week
        SDImageCache.shared.config.maxMemoryCost = 1024 * 1024 * 20
        SDImageCache.shared.config.shouldCacheImagesInMemory = false //Default True => Store images in RAM cache for Fast performance
        //These two are needing to be fixed
        SDImageCache.shared.config.diskCacheReadingOptions = NSData.ReadingOptions.mappedIfSafe
}

So I am also trying to avoidDecodeImage to help with this further. Do you know what code I would be using if I just wanted to set it as a global in the AppDelegate?

I am fairly new to this so any help would be greatly appreciated.

Thank you so much!

@ghost
Copy link

ghost commented Sep 13, 2019

Having the same issue. In the documentation, the Common Problems section includes one entitled:

Configuration for large images (avoid high memory usage)

And for which
SDImageCache.shared().config.shouldDecompressImages = false SDWebImageDownloader.shared().shouldDecompressImages = false
No longer works. The migration guide (https://sdwebimage.github.io/sdwebimage-50-migration-guide.html) mentions that SDImageCacheConfig

shouldDecompressImages removed. Use SDImageCacheAvoidDecodeImage in cache options instead

and for SDWebImageDownloader now uses

shouldDecompressImages removed. Use SDWebImageDownloaderAvoidDecodeImage in downloader options instead

But I've tried and failed to get this implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants