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

2023-12-08

我正在开发一个 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];
}

该代码位于应用程序委托中。我面临的问题是,这在 iOS 模拟器中运行良好,但当我尝试在 iPad 上运行时,出现以下错误:

[someViewController copyWithZone:] unrecognized selector sent to instance.

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

iOS copyWithZone 仅在使用设备时无法识别选择器 的相关文章

随机推荐