我有 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/