Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios SDWebImage thumb+;原始图像加载问题_Ios_Objective C_Ios9_Sdwebimage - Fatal编程技术网

Ios SDWebImage thumb+;原始图像加载问题

Ios SDWebImage thumb+;原始图像加载问题,ios,objective-c,ios9,sdwebimage,Ios,Objective C,Ios9,Sdwebimage,我正在尝试先加载缩略图图像,然后请求原始图像版本,但没有得到原始图像请求的响应 [imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { if (image) { imageView.image = image; if (originalUrl !=

我正在尝试先加载缩略图图像,然后请求原始图像版本,但没有得到原始图像请求的响应

[imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {

    if (image) {

        imageView.image = image;

        if (originalUrl != nil) {

            [imageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){

                if (image) {

                    imageView.image = image;
                }

            }];
        }
    }
}];
谢谢。

试试这个案子

[imageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (originalUrl != nil) {
            [imageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){
            }];
        }
    }
}];
这个:

[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:path]
                                                        options:nil
                                                       progress:nil
                                                      completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
                                                          if (image)
                                                          {
                                                              [self.artworkImageView sd_setImageWithURL:[NSURL URLWithString:path2] placeholderImage:image
                                                                                              completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                                                                                                  if (image)
                                                                                                      NSLog(@"magic");
                                                                                              }];
                                                          }
                                                      }];

我用下面的代码解决了我的问题

UIImageView * hiddenImageView = [[UIImageView alloc] init];

[hiddenImageView sd_setImageWithURL:thumbUrl completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {

    if (image) {

        mImageView.image = image;
    }

    if (originalUrl != nil) {

        [mImageView sd_setImageWithURL:originalUrl placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL){

            if (image) {

                mImageView.image = image; // optional
            }

        }];

    }
}];

如果image为nil,我希望将错误传递到completion块。您是否检查了
错误
?我已经检查了,第二次请求没有得到任何响应。完成处理程序中的请求是否有任何问题?首先,您不应该将image设置为imageView
imageView.image=image将自动完成。@Che我同意,但这与我的问题有什么关系。事实上,我检查了两个变体…你和我的…一切都正常…你确定在第二次调用
sd\u setImageWithURL
时吗?我的意思是,originalURL不是零。我找不到任何区别。好吧,如果你不喜欢这个变体,你可以试试另一个。补充到我的评论中。