我尝试通过URL加载图像视图,从网上获取了大量代码.不幸的是,我尝试的解决方案都没有为我工作,我得到了非常奇怪的错误.我正在获取图像数据,但没有来自此NSData的图像.我使用下面的代码和一个示例URL,它可以工作,给我代表的图像.但是,当我将其切换为使用我的实际URL时,我遇到了问题,因为它似乎正在尝试创建/返回一个太大的图像.这是我的代码:
NSString *urlString = [[[_xmlDictionary objectForKey:@"response"] objectForKey:@"movie"] objectForKey:@"poster"];
NSArray *parts = [urlString componentsSeparatedByString:@"\""];
urlString = [parts objectAtIndex:1];
urlString = [urlString stringByAppendingFormat:@"/"];
urlString = [urlString
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//NSURL * imageURL = [NSURL URLWithString:urlString];
NSLog(@"URL:%@",urlString);
NSURL * imageURL = [NSURL URLWithString:urlString];
NSData * imageData = [[NSData alloc] initWithContentsOfURL:imageURL];
UIImage * image = [[UIImage alloc] initWithData:imageData];
m_imageView = [[UIImageView alloc] initWithImage:image];
m_imageView.frame = CGRectMake(10, 10,300,300);
[self.view addSubview:m_imageView];
[imageData release];
[image release];
Run Code Online (Sandbox Code Playgroud)
我很感激任何帮助,提前谢谢.
我只是想知道我们如何通知使用iPhone应用程序的最终用户现在可以在应用程序商店中使用这个iPhone应用程序的新版本,特别是当我们没有考虑此功能时我们没有编写早期的iPhone应用程序.