Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.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
Iphone SDWebImage损坏的图像_Iphone_Objective C_Ios_Ipad_Sdwebimage - Fatal编程技术网

Iphone SDWebImage损坏的图像

Iphone SDWebImage损坏的图像,iphone,objective-c,ios,ipad,sdwebimage,Iphone,Objective C,Ios,Ipad,Sdwebimage,我正在使用(2.7.3框架)并且收到损坏的图像,我无法确切理解问题所在。如果是代码(内存…) (注: 我使用SDWebImage项目而不是框架得到了相同的错误。 我正在实现“自动释放”和其他类型的内存管理。 此问题出现在设备(iPad)上,但不在模拟器中) //另一种 UIImage * imageTv = [UIImage imageNamed:@"bgDefaultTvImage.png"]; UIImageView * bgTvImage = [[UIImageView alloc] i

我正在使用(2.7.3框架)并且收到损坏的图像,我无法确切理解问题所在。如果是代码(内存…)

(注: 我使用
SDWebImage
项目而不是框架得到了相同的错误。 我正在实现“自动释放”和其他类型的内存管理。 此问题出现在设备(iPad)上,但不在模拟器中)

//另一种

UIImage * imageTv = [UIImage imageNamed:@"bgDefaultTvImage.png"];
UIImageView * bgTvImage = [[UIImageView alloc] initWithFrame:CGRectMake(startX, 20, imageTv.size.width, imageTv.size.height)];
[bgTvImage setImage:imageTv];

CGFloat sizeWithIcon = imageTv.size.width;
CGFloat sizeHeightIcon = imageTv.size.height;
__block UIImageView * bgImageicon = [[UIImageView alloc] initWithFrame:CGRectMake((bgTvImage.frame.size.width-sizeWithIcon)/2,
                                                                          (bgTvImage.frame.size.height-sizeHeightIcon)/2,
                                                                          sizeWithIcon,
                                                                          sizeHeightIcon)];
bgImageicon.contentMode = UIViewContentModeScaleAspectFit;
[bgTvImage addSubview:bgImageicon];
[tvTopView addSubview:bgTvImage];

/*
 * Request ProgramImage
 */
[[SDWebImageManager sharedManager] downloadWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@&width=300",program.ProgramImage.imageURL]]
                                              delegate:self options:SDWebImageProgressiveDownload success:^(UIImage *image, BOOL cached) {
                                                  if (image) {
                                                      iconCanal = image;
                                                      [bgImageicon setImage:iconCanal];
                                                  }
                                                  [bgImageicon release];
                                              }failure:^(NSError *error) {
                                                  [bgImageicon release];
                                              }];

Xcode日志:

<Error>: ImageIO: JPEG Corrupt JPEG data: bad Huffman code
<Error>: ImageIO: JPEG Corrupt JPEG data: premature end of data segment
:图像IO:JPEG损坏的JPEG数据:错误的哈夫曼代码
:ImageIO:JPEG损坏的JPEG数据:数据段过早结束

这似乎是
SDWebImageProgressiveDownload
标志的问题。尝试禁用它,例如:

[[SDWebImageManager sharedManager] downloadWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@&width=300",program.ProgramImage.imageURL]]
                                          delegate:self options:0 success:^(UIImage *image, BOOL cached) {
                                              if (image) {
                                                  iconCanal = image;
                                                  [bgImageicon setImage:iconCanal];
                                              }
                                              [bgImageicon release];
                                          }failure:^(NSError *error) {
                                              [bgImageicon release];
                                          }];

我刚刚看到“路径”应用程序有同样的问题…你找到解决方案了吗?没有,但有时情况会发生变化,但是相等的…:(
[[SDWebImageManager sharedManager] downloadWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@&width=300",program.ProgramImage.imageURL]]
                                          delegate:self options:0 success:^(UIImage *image, BOOL cached) {
                                              if (image) {
                                                  iconCanal = image;
                                                  [bgImageicon setImage:iconCanal];
                                              }
                                              [bgImageicon release];
                                          }failure:^(NSError *error) {
                                              [bgImageicon release];
                                          }];