美文网首页
SDWebImage与Cookie

SDWebImage与Cookie

作者: 叫我大表弟吧 | 来源:发表于2017-06-06 12:26 被阅读144次

    使用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
    

    相关文章

      网友评论

          本文标题:SDWebImage与Cookie

          本文链接:https://www.haomeiwen.com/subject/cupgfxtx.html