Downloading image from server without file extension (NSData to UIImage)

Posted by Msencenb on Stack Overflow See other posts from Stack Overflow or by Msencenb
Published on 2012-06-26T02:49:11Z Indexed on 2012/06/26 3:16 UTC
Read the original article Hit count: 113

Filed under:
|
|
|
|

From my server I'm pulling down a url that is supposed to simply be a profile image. The relevant code for pulling down the image from the urls is this:

NSString *urlString = [NSString stringWithFormat:@"%@%@",kBaseURL,profile_image_url];
profilePic = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]];

My url is in the format (note no file extension on the end since its dynamically rendered)

localhost:8000/people/1/profile_image

If I load the url in my browser the image displays; however the code above for pulling down the UIImage does not work. I've verified that the code does pull an image from a random site on the interwebs.

Any thoughts on why this is happening?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ios