Load nsimage from url but only some url's work
Posted
by happyCoding25
on Stack Overflow
See other posts from Stack Overflow
or by happyCoding25
Published on 2010-04-18T03:15:52Z
Indexed on
2010/04/18
3:23 UTC
Read the original article
Hit count: 536
I have some code that loads an image file off the web and puts it in an image view. The problem is it works with everything but Google Charts. This is frustrating because I was relying on this to graph data for my app. Heres the url I need to load: Click to see my test chart. Im not sure why NSImage seems to refuse to load this when it works with everything elese. If you know why or have a work-around any help is appreciated.
Heres some sample code I found that I'm using to load the images:
NSURL *imageURL = [NSURL URLWithString:@"http://chart.apis.google.com/chart?cht=p3&chs=700x400&chd=t:20,20,20,20,20&chl=A|B|C|D|E&chco=66FF33,3333CC"];
NSLog(@"url");
NSData *imageData = [imageURL resourceDataUsingCache:NO];
NSLog(@"data");
NSImage *imageFromBundle = [[NSImage alloc] initWithData:imageData];
(Note: This code will load any image except a chart)
Thanks
© Stack Overflow or respective owner