开发者

Load google chart image url in iOS App

开发者 https://www.devze.com 2022-12-25 05:23 出处:网络
I want to show concentric pie chart from google chart api but the imageData variable returns null value and image doesn\'t loaded.

I want to show concentric pie chart from google chart api but the imageData variable returns null value and image doesn't loaded.

Please check following code for reference:

NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL 

URLWithString:@"http://chart.apis.google.com/chart?cht=pc&chd=t:120,45|120,60,50,70,60&chs=300x200&chl=||helo|wrd|india|pak|ban&chco=FFFFFF|FFFFFF,e72a28|a9d331|ffce08|8a2585|184a7d"]]; UIImage *myimage = [[UIImage alloc] initWithData:imageData]; self.myImageView.image=myimage;

Help me t开发者_如何学Co solved this issue.


used url string encoding method to recover from this problem,

like this-

NSString *str=@"your respected url";
NSString *myurl=[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

0

精彩评论

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