【发布时间】:2014-08-07 23:57:12
【问题描述】:
我正在尝试使用此库异步下载图像 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
中发送的身份验证令牌有没有办法下载图片异步添加标题?
【问题讨论】:
-
你需要在这个库中找到创建请求的地方,然后设置auth token
-
谢谢,我花了一段时间才找到它,但通过一些小的改动,我设法更改了标题,非常感谢。生病发布代码。
标签: objective-c uiimageview uiimage nsmutableurlrequest