قالب وردپرس درنا توس
Home / IOS Development / ios – Download image using SDWebImage, error -999

ios – Download image using SDWebImage, error -999



I can't download the image in Objective c Using SDWebImage 4.4.5 version. I tried the following, nothing worked.

Try 1:

[self.thumbnailImageView sd_setImageWithURL:[NSURL URLWithString:thumbnailURLString]   completed: ^ (UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {

}]

Try 2:

[self.thumbnailImageView sd_setImageWithURL:[NSURL URLWithString:thumbnailURLString]   placeholderImage: zero options: SDWebImageRefreshCached finished: ^ (UIImage * image, NSError * error, SDImageCacheType cacheType, NSURL * imageURL) {if (image! = Null) {
self.thumbnailImageView.image = image;
} other {
NSLog (@ "Photo not available, retrieve");
[self.thumbnailImageView sd_setImageWithURL:[NSURL URLWithString:thumbnailURLString] placeholderImage: zero options: SDWebImageRefreshCached finished: ^ (UIImage * image, NSError * error, SDImageCacheType cacheType, NSURL * imageURL) {
if (image! = nil) {NSLog (@ "Lo Res Image Loaded by% ld from & # 39;% @ & # 39;", (long) cacheType, imageURL);
self.thumbnailImageView.image = image;

} other {
self.thumbnailImageView.image = nil;

}}];

}}];

[[SDWebImageDownloader sharedDownloader]   Try 3: 

[[SDWebImageDownloader sharedDownloader]   downloadImageWithURL: [NSURL URLWithString:thumbnailURLString] options: SDWebImageDownloaderUseNSURLCache progress: zero ended: ^ (UIImage * image, NSData * data, NSError * error, BOOL completed) {


}];

Try 4:

  SDWebImageManager * manager = [SDWebImageManager sharedManager];

[managerloadImageWithURL:[NSURL URLWithString:thumbnailURLString] options: SDWebImageDelayPlaceholder progress: ^ (NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
} completed: ^ (UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL completed, NSURL * _Nullable imageURL) {

}];

Try 5:

  SDWebImageDownloader * manager = [SDWebImageManager sharedManager] .imageDownloader;
[manager setValue:@"application/vnd.learning.events.v1
+json" forHTTPHeaderField:@"Accept"]; [manager setValue:@"en-US" forHTTPHeaderField:@"Accept-Language"]; [manager setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; // [manager setValue:savedEmail forHTTPHeaderField:@"Email"]; [manager setValue:savedToken forHTTPHeaderField:@"Authorization"]; [managerdownloadImageWithURL:[NSURL URLWithString:thumbnailURLString] options: SDWebImageDownloaderHighPriority progress: ^ (NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { } completed: ^ (UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) { self.thumbnailImageView.image = image; }];

In all of the above cases, you get the following error:

Error Domain = NSURLErrorDomain Code = -999 "canceled" UserInfo = {NSErrorFailingURLStringKey = https: //prodServer.azurewebsites.net/api/BAImage? ActionFlagId = 97 & id = 615, NSErrorFailingURLKey = https: //prodServer.azurewebsites.net/api/BAImage? ActionFlagId = 97 & id = 615, _NSURLErrorRelatedURLSessionTaskErrorKey = (
"LocalDataTask <92586538-B07D-46FB-8694-3B29AA3F0CB4>. <7>"
), _NSURLErrorFailingURLSessionTaskErrorKey = LocalDataTask <92586538-B07D-46FB-8694-3B29AA3F0CB4>. <7> NSLocalizedDescription = canceled}

Previously, we used version v3.5.4, which could download the image with the following code. It works well.

  [selfthumbnailImageViewsetImageWithURL:[NSURL URLWithString:thumbnailURLString]
placeholderImage: null
completed: ^ (UIImage * image, NSError * error, SDImageCacheType cacheType) {
if (image! = null) {
self.thumbnailImageView.image = [self imageResizingToAspetRatio:image];

}
}];

Please let us know if there were any errors or suggestions.

Update 1:
Attempted to download the image using the postman. Please check the picture.
The same image address works on SDWebImage v3.5.4 after upgrading to SDWebImage v4.4.5, it does not post the image.

Are there any configurations I lack? Installed pod & # 39; SDWebImage / WebP & # 39; added to SD_WEBP = 1 in Build Settings -> Preprocessor Macros.

Error: Error Domain = SDWebImageErrorDomain Code = 0 "Downloaded image has 0 pixels" UserInfo = {NSLocalizedDescription = Downloaded image has 0 pixels}

 enter image description here


Source link