合成されたNSMutableArray--theResultArrayがあります。NSNumberまたはNSIntegerオブジェクトを特定のインデックス(0〜49)に挿入したい。何らかの理由で、配列に固定する値を取得できません。すべてのインデックスはnilまたは0を返します。
NSInteger timeNum = time;
[theResultArray insertObject:[NSNumber numberWithInt:timeNum] atIndex:rightIndex];
NSLog(@"The right index is :%i", rightIndex);
NSLog(@"The attempted insert time :%i", time);
NSNumber *testNum = [theResultArray objectAtIndex:rightIndex];
NSLog(@"The result of time insert is:%i", [testNum intValue]);
viewDidLoadでtheResultsArrayを割り当てて初期化します。時間は整数です。私は上記のコードのさまざまな組み合わせを試しましたが、役に立ちませんでした。
コンソールはこれを出力します:
StateOutlineFlashCards[20389:20b] The right index is :20
StateOutlineFlashCards[20389:20b] The attempted insert time :8
StateOutlineFlashCards[20389:20b] The result of time insert is:0