我正在尝试查看加载了 NSMutableArray 的 NSMutableDictionary 并且我把它搞砸了,我不知道怎么做。我正在尝试加载更大的游戏问题列表,如果它们不是正确的级别,则将其删除。在我尝试删除之前,我没有收到错误消息。任何人都可以看到这段代码中的缺陷吗?我会非常感激的!
谢谢,
〜G
{
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
NSString *GameLevel = [[NSString alloc] initWithFormat: [settings objectForKey:kLevelKey]];
NSBundle *Bundle = [NSBundle mainBundle];
NSString *PListPath = [Bundle pathForResource:@"questions" ofType:@"plist"];
NSMutableDictionary *Dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:PListPath];
self.QuestionDetailsByLevel = Dictionary;
[Dictionary release];
NSMutableArray *Components = [[NSMutableArray alloc] initWithArray:[QuestionDetailsByLevel allKeys]];
self.QuestionsByLevel = Components;
int QuestionCount = [self.QuestionsByLevel count] - 1;
for (int j = 0; j < QuestionCount - 1; j++)
{
NSString *SelectedQuestion = [self.QuestionsByLevel objectAtIndex:j];
NSMutableArray *Array = [QuestionDetailsByLevel objectForKey:SelectedQuestion];
self.QDetailsByLevel = Array;
NSString *level = [[NSString alloc] initWithFormat:[self.QDetailsByLevel objectAtIndex:Level]];
if (level != GameLevel)
[QuestionsByLevel removeObjectAtIndex:j];
}
}