配列に書き込もうとしているのですが、「NSInvalidArgumentException」という問題があります
私はObjective Cから始めています。
ここに私のコードの一部があります:
int charIndex;
unichar testChar1, testChar2;
NSString *valeur1, *valeur2;
NSMutableArray* tableau1 = [NSMutableArray arrayWithCapacity:4];
NSMutableArray* tableau2 = [NSMutableArray arrayWithCapacity:4];
for(charIndex=0; charIndex < 4; charIndex++) {
testChar1 = [_saisie.text characterAtIndex:charIndex];
testChar2 = [[NSString stringWithFormat:@"%d", nombreChoisi] characterAtIndex:charIndex];
NSLog(@"%C", testChar1);
valeur1 = [NSString stringWithFormat:@"%C", testChar1];
valeur2 = [NSString stringWithFormat:@"%C", testChar2];
[tableau1 replaceObjectAtIndex:charIndex withObject:valeur1];
[tableau2 replaceObjectAtIndex:charIndex withObject:valeur2];
}
valeur1
変数が value を取る14 行目まで、すべてが機能していますnil
。
どこに問題があるのかわからない。
編集: NSLog の行は { @"%C", value } をテストするためにここにあり、機能します。値「nombreChoisi」は前にランダム関数で選択され、「_saisie.text」はテキスト フィールドから取得されます。