NSMutableArray がロードされた NSMutableDictionary を調べようとしていますが、めちゃくちゃになっていて、方法がわかりません。ゲームの質問のより大きな plist を読み込もうとしていますが、適切なレベルでない場合は削除します。削除しようとするまでエラーは発生しません。誰かがこのコードの欠陥を見ることができますか? 私はそれを非常に感謝します!
ありがとう、
~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];
}
}