I am trying to use the AFNetworking UIImageView call to load images from a URL, as shown below:
[self.image setImageWithURL:[NSURL URLWithString:feed.imageURL] placeholderImage: [UIImage imageNamed:@"logo"]];
The placeholder image is always displayed, but the actual image from the feed.imageURL file is never executed. I checked that the url is really correct. I even hardcoded it to make sure, and still nothing.
My main application setup is a tab controller ... and in viewDidLoad I call the "fetchFeed" method, which makes an HTTP request to collect my JSON data.
My request block looks like this:
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { [self parseDictionary:JSON]; isLoading = NO; [self.tableView reloadData]; } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) { NSLog(@"Error: %@", error); [self showNetworkError]; isLoading = NO; [self.tableView reloadData]; }]; operation.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", nil]; [queue addOperation:operation];
Adam johnson
source share