iOS copyWithZone仅在使用设备时无法识别选择器 [英] iOS copyWithZone unrecognized selector only when using device
问题描述
我正在开发一款iPad应用程序,只有当sqlite数据库中存在某些数据时才会启动初始屏幕,如下所示:
I'm working on an iPad app that launches an initial screen only when there is certain data in a sqlite DB, something like this:
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上运行时,我收到以下错误:
That code is in the app delegate. The problem I'm facing is that this works fine in iOS Simulator, but when I try to run on iPad I get the following error:
[someViewController copyWithZone:] unrecognized selector sent to instance.
推荐答案
UIViewController未实现NSCopying协议。除非您在自己的UIViewController子类中实现了NSCopying,否则视图控制器将不会响应 -copyWithZone:
。
UIViewController doesn't implement the NSCopying protocol. Unless you've implemented NSCopying in your own UIViewController subclass, your view controller won't respond to -copyWithZone:
.
这篇关于iOS copyWithZone仅在使用设备时无法识别选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!