如何在NSURL URLWithString中评估字符串

时间:2012-12-06 15:42:50

标签: ios6

我正在尝试加载图片 - 我从JSON获取网址 - 字典

字典: api.amioamio.com/?v=1&id=2&pass=8d4a9a5648640eca8f8da4416d0f6999&cmd=getShop&p%5BshopId%5D=110

我写的时候工作正常 - 但如果我尝试使用字符串变量 - 它就无法生成imageURL

继承我的代码:

NSString * strURLTemp = [[NSString alloc] initWithFormat:@“[[[image objectForKey:@ \”%@ \“] objectForKey:@ \”images \“] objectForKey:@ \”small \“]”, [keys objectAtIndex:0]];

NSLog(@"%@",strURLTemp);//[[[images objectForKey:@"78044"] objectForKey:@"images"] objectForKey:@"small"]


//NSURL *imageURL1 = [NSURL URLWithString:[[[images objectForKey:@"100256"] objectForKey:@"images"] objectForKey:@"small"]];

NSURL *imageURL1 = [NSURL URLWithString:strURLTemp];
NSData *imageData1 = [NSData dataWithContentsOfURL:imageURL1];
UIImage *img1 = [UIImage imageWithData:imageData1];

我该如何使这项工作?谢谢!

0 个答案:

没有答案