iOS copyWithZone unrecognized selector only when using device

1.2k Views Asked by At

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

There are 1 best solutions below

0
On

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