iOS copyWithZone unrecognized selector only when using device

烈酒焚心 提交于 2019-12-02 04:52:23

问题


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];
}

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.

回答1:


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:.



来源:https://stackoverflow.com/questions/8539522/ios-copywithzone-unrecognized-selector-only-when-using-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!