【问题标题】:iOS copyWithZone unrecognized selector only when using deviceiOS copyWithZone 仅在使用设备时无法识别选择器
【发布时间】:2011-12-16 20:06:03
【问题描述】:

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

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.

【问题讨论】:

    标签: ipad ios5 copywithzone


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-10-17
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-09
      相关资源
      最近更新 更多