【发布时间】:2011-06-24 18:34:40
【问题描述】:
@implementation SlideShowViewController
- (id)init
{
NSString *temp = [NSString alloc];
[temp stringwithString:@"http://www.inetwallpaper.com/homescreenhero/sunsets/wall009.jpg"];
temp=[(NSString *)CFURLCreateStringByAddingPercentEscapes(
nil,
(CFStringRef)temp,
NULL,
NULL,
kCFStringEncodingUTF8)
autorelease];
NSData *dato = [NSData alloc];
dato=[NSData dataWithContentsOfURL:[NSURL URLWithString:temp]];
if (self = [super initWithNibName:nil bundle:nil])
{
NSArray * images = [NSArray arrayWithObjects:[UIImage imageWithData:dato],[UIImage imageWithData:dato], [UIImage imageWithData:dato], [UIImage imageWithData:dato], [UIImage imageWithData:dato], nil];
self.view = [[[SlideShowView alloc] initWithImages:images] autorelease];
}
return self;
}
我使用以下代码从服务器加载图像并将其视为相册的图像
但是当代码运行时它会崩溃 控制台报错信息如下
2011-06-24 23:54:01.837 幻灯片[13654:207] * -[NSPlaceholderString stringwithString:]:无法识别 选择器发送到实例 0x49117e0 2011-06-24 23:54:01.839 幻灯片[13654:207] 终止 应用程序由于未捕获的异常 'NSInvalidArgumentException',原因: '** -[NSPlaceholderString stringwithString:]: 无法识别 选择器发送到实例 0x49117e0' 2011-06-24 23:54:01.840 幻灯片[13654:207] 堆栈:( 42178640, 43336492, 42187355, 41649782, 41646578, 12567, 7791, 2906510, 2910543, 2936126, 2917623, 2949592, 51171708, 41457820, 41453736, 2908705 ) 在抛出“NSException”实例后调用终止
如果 URL 被图像替换,它就可以工作 谁能帮助我 我是一个初学者,所以我很难找到它
谢谢
【问题讨论】:
标签: iphone