I use AFNetworking to get beer details from my rails api, and I want to show an image from a url that is returned.
Example API response
description = "Super tasty";
id = 3;
"label_url" = "/system/beers/labels/000/000/003/medium/Pliny.png?1363034728";
"location_id" = 2;
name = "Pliny The Elder";
price = "3.5";
style = IPA;
The label_url is the url for the image, which I'm trying to display in the BeerDetailViewController. Here is what I've tried so far, which builds with no errors but no image displays.
BeerDetailViewController.m
#import "UIImageView+AFNetworking.h"
#import "AFImageRequestOperation.h"
- (void)viewDidLoad
{
[super viewDidLoad];
beerLabel.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString: beer_label]]];
Any ideas why it's not working? I can display the url in this view with something like beerLabel.text = beer_label
so I know it's coming through and read to be used, just not sure why it isn't displaying an image.