Kingfisher加载不出带逗号的图片url

ps:不是逗号的原因,但是逗号是这个url的特征,方便搜索
使用版本:3.1.3
如:http://img2.imgtn.bdimg.com/it/u=2627069709,2509213581&fm=21&gp=0.jpg

解决

参考
https://github.com/rs/SDWebImage/issues/1228

ImageDownloader.swift文件299行加入User-Agent

    func downloadImage(with url: URL,
              retrieveImageTask: RetrieveImageTask?,
                        options: KingfisherOptionsInfo?,
                  progressBlock: ImageDownloaderProgressBlock?,
              completionHandler: ImageDownloaderCompletionHandler?) -> RetrieveImageDownloadTask?
    {
        if let retrieveImageTask = retrieveImageTask, retrieveImageTask.cancelledBeforeDownloadStarting {
            return nil
        }
        
        let timeout = self.downloadTimeout == 0.0 ? 15.0 : self.downloadTimeout
        
        // We need to set the URL as the load key. So before setup progress, we need to ask the `requestModifier` for a final URL.
        var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: timeout)
        request.httpShouldUsePipelining = requestsUsePipeling
      //这儿
        request.allHTTPHeaderFields = ["User-Agent":"App/iOS"]
....下面省略

你可能感兴趣的:(Kingfisher加载不出带逗号的图片url)