这是什么意思呢? class不是密钥QS1的密钥值编码兼容。 [英] what is the meaning of this this" class is not key value coding-compliant for the key QS1."
本文介绍了这是什么意思呢? class不是密钥QS1的密钥值编码兼容。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的代码
NSString * questionString = [[NSString alloc] initWithFormat: @ %lu,[问题数]];
int questions = [questionString intValue];
NSString * answerString = [[NSString alloc] initWithFormat: @ %lu,[答案数]];
int answers = [answerString intValue] / 3;
NSString * correctAnswersString = [[NSString alloc] initWithFormat: @ %lu,[ correctAnswers count]];
int correctAnswers = [correctAnswersString intValue];
if ((questions = answers)&&(questions == correctAnswers)){
NSLog( @ 问题,答案和正确答案);
}
else
{
NSLog( @ \ n警告APP将崩溃\ nSOLUTION:\ n如果您有相同数量的问题和正确答案,请检查,如果您为每个问题提供3个答案!);
NSLog( @ \ nNESESTIONS =%d \ nANSWERS =%d(3连多) \\ n \\ nCORRECTANSWERS =%d,questions,[answerString intValue],correctAnswers);
}
}
解决方案
你错过了一个 =在这一行中
if((questions == answers)&&(questions == correctAnswers))
错误说你在KVO中QS1,但我没有看到任何。这是你没有展示的方法或类名吗?
我的提示是,你使用了KVO语法,但没有实现它。
您应该阅读 Apple的文档以了解复杂的KVO。
below is my code
NSString *questionString = [[ NSString alloc] initWithFormat:@"%lu",[questions count]];
int questions = [questionString intValue];
NSString *answerString = [[NSString alloc] initWithFormat:@"%lu" , [answers count]];
int answers = [answerString intValue]/3;
NSString *correctAnswersString = [[NSString alloc] initWithFormat:@"%lu" , [correctAnswers count]];
int correctAnswers = [correctAnswersString intValue];
if ((questions = answers) && (questions == correctAnswers)) {
NSLog(@"Questions, answers and correct answers written");
}
else
{
NSLog(@"\nWARNING APP WILL CRASH \nSOLUTION: \nCheck if you have the same amount of questions and CORRECT answers, AND if you jave 3 answers for each question!");
NSLog(@"\nQUESTIONS = %d \nANSWERS = %d (3 tiems more) \nCORRECTANSWERS = %d ", questions , [answerString intValue] , correctAnswers);
}
}
解决方案
you missed a "=" in this line
if ((questions == answers) && (questions == correctAnswers))
The error says that you QS1 in KVO but I dont see any. It is a method or class name which you didnt show?
My tip is that, you used KVO-syntax but dont implement it.
You should read the Documenation from Apple to understand the complex KVO.
这篇关于这是什么意思呢? class不是密钥QS1的密钥值编码兼容。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文