base64有时无法解码从webserver获取的图像数据

时间:2011-04-08 19:11:53

标签: iphone xml base64 nsdata

我使用XML参数从运行在Web服务器上的.NET程序中获取base64编码的图像。

我能够下载编码的图像数据,但其中一些被解码为null。我正在使用here中的base64类。

我通过将变量的内容打印到控制台来验证数据为空。

代码:

NSString *theXML = [[NSString alloc] initWithData:decode encoding:NSUTF8StringEncoding];
NSData *decodedimage = [Base64 decode:theXML];
NSLog(@">>>>>>>>>>>>>>>>>> %@",decodedimage);
UIImage *image = [UIImage imageWithData:decodedimage];

我每次都会获得theXML,但对于某些图片,我(null)会获得decodedimage

0 个答案:

没有答案