iOS错误,我可以';t复制
我在应用商店里有一个复习测验应用,在过去的3个月里每天下载10次。它被很好地使用,并且大部分都有很好的评价。然而,最近我得到了两个1星级的评价,因为人们抱怨在测验结束后“评价”屏幕是空白的 我在iphone5/5c/5s上试用过,效果非常好。这些是我能接触到的唯一设备,但我也为iPad和两个iPhone 6版本运行了模拟器,我无法复制这个问题 流程是RootController->QuizController->ResultsController->ReviewController。测验控制器有一个名为GameManager的对象作为实例变量。这会随着测验的进行跟踪用户的答案和问题,并在分段过程中从测验传递到结果,然后再传递到复习部分 传递对象的函数有:iOS错误,我可以';t复制,ios,objective-c,Ios,Objective C,我在应用商店里有一个复习测验应用,在过去的3个月里每天下载10次。它被很好地使用,并且大部分都有很好的评价。然而,最近我得到了两个1星级的评价,因为人们抱怨在测验结束后“评价”屏幕是空白的 我在iphone5/5c/5s上试用过,效果非常好。这些是我能接触到的唯一设备,但我也为iPad和两个iPhone 6版本运行了模拟器,我无法复制这个问题 流程是RootController->QuizController->ResultsController->ReviewController。测验控制器有
//From Quiz to Results
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"quiz2results"])
{
// Get reference to the destination view controller
ResultsController *vc = [segue destinationViewController];
// Pass any objects to the view controller here, like...
[vc setManager:_manager];
}
}
//From Results to Review
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"results2review"])
{
// Get reference to the destination view controller
ReviewController *vc = [segue destinationViewController];
// Pass any objects to the view controller here, like...
[vc setManager:_manager];
}
}
然后在审查控制器中执行以下代码:
-(void)setReviewText{
NSArray* questions = [[NSArray alloc] init];
questions = [_manager getAllQuestions];
NSMutableArray* userAnswer = [[NSMutableArray alloc] init];
userAnswer = [self answersAttributed];
if (userAnswer == nil)
{
_output.text = @"Error";
}
NSMutableAttributedString *mutableAttString = [[NSMutableAttributedString alloc] init];
int i = 0;
NSAttributedString *linebreak =[[NSAttributedString alloc] initWithString:@"\n"];
for (Question* q in questions)
{
if (i == [userAnswer count])
break;
NSAttributedString *qtext =[[NSAttributedString alloc] initWithString:q.questionText];
NSAttributedString *ctext =[[NSAttributedString alloc] initWithString:@"Correct Answer:\n"];
NSAttributedString *atext =[[NSAttributedString alloc] initWithString:q.answerText];
NSAttributedString *ytext =[[NSAttributedString alloc] initWithString:@"Your Answer:\n"];
NSAttributedString *utext =[[NSAttributedString alloc] initWithAttributedString:userAnswer[i]];
[mutableAttString appendAttributedString:qtext];
[mutableAttString appendAttributedString:linebreak];
[mutableAttString appendAttributedString:ctext];
[mutableAttString appendAttributedString:atext];
[mutableAttString appendAttributedString:linebreak];
[mutableAttString appendAttributedString:ytext];
[mutableAttString appendAttributedString:utext];
[mutableAttString appendAttributedString:linebreak];
[mutableAttString appendAttributedString:linebreak];
i++;
}
NSAttributedString* outText = [[NSAttributedString alloc] init];
outText = [mutableAttString mutableCopy];
_output.attributedText = outText;
[_output setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]];
}
-(NSMutableArray*)answersAttributed
{
NSMutableArray* ansAtt = [[NSMutableArray alloc] init];
NSArray* questions = [[NSArray alloc] init];
questions = [_manager getAllQuestions];
NSArray* userAnswers = [[NSArray alloc] init];
userAnswers = [_manager getAllUserAnswers];
if ([questions count] != [userAnswers count])
{
return ansAtt;
}
int i = 0;
for (NSString* userAnswer in userAnswers )
{
if([[questions[i] answerText] isEqualToString:userAnswer] )
{
NSDictionary *attributes = @{NSBackgroundColorAttributeName:[UIColor greenColor]};
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:userAnswer attributes:attributes];
[ansAtt addObject:attrString];
}
else
{
NSDictionary *attributes = @{NSBackgroundColorAttributeName:[UIColor redColor]};
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:userAnswer attributes:attributes];
[ansAtt addObject:attrString];
}
i++;
}
return ansAtt;
}
如果有人能解释一下,我会很高兴的。到目前为止,这个问题的原因一直在暗指我。blank表示某个内容为零,或者情节提要不好(我指的是约束混乱或类似内容)。我知道我帮不了什么忙,但你有没有那样看?如果用户试图点击“下一步”而不回答所有问题/根本不回答。有些数据无法传递,因此您的审阅页面将是无数据的。请查看您退出处理的错误情况,是什么原因导致这些错误?不太可能有人能提供最新信息。