获取 data 的 url 的键值,然后获取 uiimage 时出现问题
我有一个带有标签的网址:
http://ws.cdyne.com/WeatherWS/Images/ sunny.gif
当我这样做时:
NSURL *url=[NSURL URLWithString:@"http://ws.cdyne.com/WeatherWS/Images/sunny.gif"];
它正在 gdb 中获取图像,我可以从此 URL 下载。但是当我编写这样的代码时:(
NSURL *url=[jsonItem objectForKey:@"PictureURL"];
其中 jsonItem
是字典并将其传递给数据,然后传递给 UIImage
),然后它显示异常。
获得:的值
[jsonItem objectForKey:@"PictureURL"];
当我在 gdb 中
2011-03-15 11:08:16.405 XML[1576:20b] jsonURKL ..... ...
http://ws.cdyne.com/WeatherWS/Images/thunderstorms.gif (in next line in gdb)
时,它会显示如下:我需要通过此下载:
NSURL *url=[jsonItem objectForKey:@"PictureURL"];
我无法做到这一点。可能出什么问题了?
I have a URL with tag:
http://ws.cdyne.com/WeatherWS/Images/sunny.gif
When I do like this:
NSURL *url=[NSURL URLWithString:@"http://ws.cdyne.com/WeatherWS/Images/sunny.gif"];
it's getting image in gdb and I am able to download from this URL. But when I write code like this:
NSURL *url=[jsonItem objectForKey:@"PictureURL"];
(where jsonItem
is dictionary and passing it to data and then to UIImage
), then it shows an exception.
When I get the value of:
[jsonItem objectForKey:@"PictureURL"];
in gdb then it shows like:
2011-03-15 11:08:16.405 XML[1576:20b] jsonURKL ..... ...
http://ws.cdyne.com/WeatherWS/Images/thunderstorms.gif (in next line in gdb)
I need to download through this:
NSURL *url=[jsonItem objectForKey:@"PictureURL"];
I am not able to do that. What could be wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
URL 本身是一个字符串。
所以你现在必须使用下面的代码
setimgge 与
[UIImage imageWithData: data];
此代码Url itself one string.
so you have to use below code
now setimgge with
[UIImage imageWithData: data];
this code请按以下方式执行此操作,
please do this in following way,