Sdwebimage download pictures sometimes do not show up successfully

Source: Internet
Author: User

Before using the following method now the picture, sometimes appears the picture does not download successfully displays:

-(void) Sd_setimagewithurl: (nsurl *) URL placeholderimage: (UIImage *) placeholder;

Later studies, there are the following methods:

-(void) Sd_setimagewithurl: (nsurl *) URL placeholderimage: (UIImage *) placeholder options: (sdwebimageoptions) options;

The focus is on this sdwebimageoptions, and the documentation is as follows:

typedef ns_options (Nsuinteger, sdwebimageoptions) {

/**

* By default, when a URL of fail to being downloaded, the URL is blacklisted so the library won ' t keep trying.

* This flag disable this blacklisting.

*/

sdwebimageretryfailed = 1 << 0,

/**

* By default, image downloads is started during UI interactions, this flags disable this feature,

* Leading to delayed download in Uiscrollview deceleration for instance.

*/

sdwebimagelowpriority = 1 << 1,

/**

* This flag disables On-disk caching

*/

sdwebimagecachememoryonly = 1 << 2,

/**

* This flag enables progressive download, the image was displayed progressively during download as a browser would do.

* By default, the image was only displayed once completely downloaded.

*/

Sdwebimageprogressivedownload = 1 << 3,

/**

* Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if need Ed.

* The disk caching is handled by Nsurlcache instead of Sdwebimage leading to slight performance degradation.

* This option helps deal with images changing behind the same request URL, e.g. Facebook Graph API Profile pics.

* If A cached image is refreshed, the completion block was called once with the cached image and again with the final image .

*

* Use this flag only if you can ' t make your URLs static with embedded cache busting parameter.

*/

sdwebimagerefreshcached = 1 << 4,

/**

* In IOS 4+, continue the download of the image if the app is goes to background. This was achieved by asking the system for

* Extra time in background to let the request finish. If the background task expires the operation is to be cancelled.

*/

Sdwebimagecontinueinbackground = 1 << 5,

/**

* Handles cookies stored in Nshttpcookiestore by setting

* Nsmutableurlrequest.httpshouldhandlecookies = YES;

*/

Sdwebimagehandlecookies = 1 << 6,

/**

* Enable to allow untrusted SSL certificates.

* Useful for testing purposes. Use with caution in production.

*/

Sdwebimageallowinvalidsslcertificates = 1 << 7,

/**

* By default, image is loaded in the order they were queued. This flag move them to

* The front of the queue and is loaded immediately instead of waiting for the current queue to be loaded (which

* could take a while).

*/

sdwebimagehighpriority = 1 << 8,

/**

* By default, placeholder images was loaded while the image is loading. This flag would delay the loading

* of the placeholder image until after the image has finished loading.

*/

Sdwebimagedelayplaceholder = 1 << 9,

/**

* We usually don ' t call Transformdownloadedimage Delegate method on animated images,

* As most transformation code would mangle it.

* Use this flag to transform them anyway.

*/

Sdwebimagetransformanimatedimage = 1 << 10,

/**

* By default, image was added to the imageView after download. Some cases, we want to

* The hand before setting the image (apply a filter or add it with Cross-fade animation for instance)

* Use this flag if you want to manually set the "image in the" completion when success

*/

Sdwebimageavoidautosetimage = 1 << 11

};

This document explains the details and then sets the options to sdwebimageretryfailed (the default download image fails and will not be downloaded again, which will cause the download to fail again), which solves the problem. There are many other options that will be useful in the appropriate situation.

Sdwebimage download pictures sometimes do not show up successfully

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.