开发者

Problem with retrieving an image

following problem:

I created a NSXMLParser subclass to get Xbox Live profile data, the class works fine but i have a problem with displayi开发者_运维知识库ng an image.

NSLog(@"%@", [[xbl.games objectAtIndex: i] objectForKey: @"Image64Url"]);

output:

http://tiles.xbox.com/tiles/+4/R1/1Wdsb2JhbC9ECgUAGwEfV1oiL2ljb24vMC84MDAwAAAAAAAAAPpahOQ=.jpg

displaying the image:

NSURL *url = [NSURL URLWithString:[[xbl.games objectAtIndex: i] objectForKey: @"Image64Url"]];
NSData *data = [NSData dataWithContentsOfURL:url]; 
gamerPicView.image = [[UIImage alloc] initWithData:data];

Does not work, but if i run:

NSURL *url = [NSURL URLWithString:@"http://tiles.xbox.com/tiles/+4/R1/1Wdsb2JhbC9ECgUAGwEfV1oiL2ljb24vMC84MDAwAAAAAAAAAPpahOQ=.jpg"];
NSData *data = [NSData dataWithContentsOfURL:url]; 
gamerPicView.image = [[UIImage alloc] initWithData:data];

Its working, im really confused whats my mistake? Thanks for help and greetings from switzerland.


I would print what 'url' is after your first (unsuccessful) attempt at displaying the image and see if it is the same URL or not as the code that works, since this seems like the only place something could be wrong.

Edit: And if you still can't figure out the problem, post the NSLog output for 'url' in both cases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜