iOS copyWithZone仅在使用设备时无法识别选择器

时间:2011-12-16 20:06:04

标签: ipad ios5 copywithzone

我正在开发一款iPad应用程序,只有在sqlite数据库中存在某些数据时才启动初始屏幕,如下所示:

if ((int)[MyStore sharedInstance].mode < 0) 
{
    self.connectionSettingsViewController = [[[ConnectionSettingsViewController alloc] initWithNibName:@"ConnectionSettingsModalViewController" bundle:nil] autorelease];
    self.connectionSettingsViewController.view.transform = CGAffineTransformMakeRotation(M_PI_2); 
    self.connectionSettingsViewController.delegate = self;
    self.launchScreen = [[[UIView alloc] initWithFrame:CGRectMake(-256, 0, 1024, 768)] autorelease];
    [self.launchScreen addSubview:self.connectionSettingsViewController.view];
    [self.window addSubview:self.launchScreen];
}

该代码位于app委托中。我面临的问题是,这在iOS模拟器中工作正常,但是当我尝试在iPad上运行时,我收到以下错误:

[someViewController copyWithZone:] unrecognized selector sent to instance.

1 个答案:

答案 0 :(得分:-1)

UIViewController未实现NSCopying协议。除非您在自己的UIViewController子类中实现了NSCopying,否则视图控制器将不会响应-copyWithZone: