带有标题Objective-C的异步图像下载

问题描述 投票:0回答:2

我正在尝试与此库异步下载图像https://github.com/rs/SDWebImage#using-asynchronous-image-caching-independently

-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
  GalleryImageCell* cell = [collectionView  dequeueReusableCellWithReuseIdentifier:@"ImageCell" forIndexPath:indexPath];
  PSGalleriesImage* imagen = [self.Images objectAtIndex:indexPath.row];

  [cell.Image setImageWithURL:[NSURL URLWithString:imagen.link]];

  return cell;
}

该图像正在下载并且运行良好,但是服务器未返回auth_token,因此服务器正在返回一个占位符图像。应当在标头X-PS-Auth-Token中发送的身份验证令牌

有没有一种方法可以下载带有标题的异步图像?

objective-c uiimageview uiimage nsmutableurlrequest
2个回答
0
投票

正如克劳迪奥所说,我只是设法改变了图书馆的工作原理。我在这里发布代码:


0
投票

如果您不想修改库,则可以将http标头设置到imageDownloader中,可能在applicationDidFinishLaunching上:

© www.soinside.com 2019 - 2024. All rights reserved.