ios - 此类对于 key screenNumber 不符合键值编码

标签 ios objective-c uiviewcontroller crash uncaught-exception

我有 2 台计算机在 Xcode 中运行相同的 iOS 代码(在 dropbox 文件夹中)。
创建 UIViewController 时,它在一台机器上正常工作,而另一台机器给出:此类对于关键 screenNumber 不符合键值编码。

我在代码中绝对没有 screenNumber 的引用,并且对于这个特定的类,没有使用任何 Storyboard,也没有使用 xib。

初始化 View 的命令:

ChildViewController *childViewController = [[ChildViewController alloc] initWithIndex:index :100];

它在此代码中的随机位置崩溃:

 -(ChildViewController *)initWithIndex:(int)index :(int)maximumIndex
    {
        self = [super init];

        if (self)
        {
            NSLog(@"Init child:%d",index);
            // Custom initialization

            self.index=index;
            maxIndex=maximumIndex;
         }

        return self;
    }

ChildViewController 派生自 UIViewController。
收到的错误消息是:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ChildViewController 0x8e0f4d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key screenNumber.'

知道我是否可以在不在项目目录中的另一个文件夹中找到 screenNumber 引用吗?我不排除我过去可能使用过这个变量,但现在不再使用了。

谢谢

最佳答案

好的,找到问题了。模拟器中仍然有旧文件。删除了 home/Preferences/Application Support/iPhone Simulator/7.1/Applications/。

关于ios - 此类对于 key screenNumber 不符合键值编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24872498/

相关文章:

ios - Swift 3.0 无法将 (_, _)->() 类型的值转换为预期参数类型 'ObjectsOrErrorBlock'

objective-c - UIPopOverView 问题中的 TableView

ios - 如何通过将类名传递给方法来创建子类 UIViewController?

ios - 如何在 "Confirm to Delete"状态且表格处于编辑模式时自定义 UITableView 单元格

objective-c - 触摸开始没有响应

ios - 从 unwind segue 中关闭 View Controller

ios - 无法让 UIScrollView 工作

ios - 如何从输入日期开始计算准确的完成天数

ios - 如何在Xcode的类外创建ObjC函数?

ios - XCode 4.1 - 仪器时间分析器