使用Cookie
-设置SDWebImageHandleCookies使用Cookie
[self.button sd_setBackgroundImageWithURL:[NSURL URLWithString:path] forState:UIControlStateNormal placeholderImage:nil options:SDWebImageHandleCookies];
储存Cookie
-设置HTTPCookieAcceptPolicy存储Cookie
import "SDWebImageDownloader+Add.h"
#import <SDWebImage/SDWebImageDownloader.h>
@implementation SDWebImageDownloader (Add)
///设置储存cookie
- (nonnull instancetype)init {
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
configuration.HTTPCookieAcceptPolicy = NSHTTPCookieAcceptPolicyAlways;
return [self initWithSessionConfiguration:configuration];
}
@end
网友评论