1

I am attempting to download an image from foursquare( sourced from using the venue api) and I keep getting NSURLErrorFileDoesNotExist = -1100, errors for trying to grab the image.

imageUrl = [NSURL URLWithString: [NSString stringWithFormat:
                                  [@"https://irs0.4sqi.net/img/general/720x400/1203715_jAVNrPE87IFuOUa69i1q5UXQ0bUAfjG8V-R_hBUL09c.jpg" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
//[cell.venueImageView sd_setImageWithURL:imageUrl placeholderImage:nil];
typeof(WHMDateListTableViewCell *) __weak weakCell = cell;
[cell.venueImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"create-profile-step-4-pic-box-reg"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    weakCell.venueImageView.image = image;
}];

The image url loads fine in Chrome. I have also pulled other images from other web urls and it works fine.

theprojectabot
  • 1,163
  • 12
  • 19

1 Answers1

1

The issue was that the API was returning images with an https scheme. Once I manipulated the returned URL to be of http, instead of https then I was able to properly download the image for imageview display.

//setup Venue
NSURL *imageUrl;

imageUrl = [NSURL URLWithString:self.selectedDate.Venue.Media[indexPath.item]];

NSURLComponents *components = [NSURLComponents new];
components.scheme = @"http";
components.host = imageUrl.host;
components.path = imageUrl.path;

NSURL *url = [components URL];


[cell.photoImageView sd_setImageWithURL:url placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    ;
}];
theprojectabot
  • 1,163
  • 12
  • 19
  • Thanks @theprojectabot, it worked for me! I was looking for a solution for hours now. – Tulleb Mar 04 '16 at 16:17
  • yeah and now with the app security settings you need to make sure that you allow that non https protected url in.. or else IOS app security will just make the url call fail. – theprojectabot Mar 05 '16 at 05:51