異なるすべての値をsqliteに挿入し、テーブルに格納されている配列がありますが、配列にアクセスすると、すべての配列indexexに対して同じ値が表示されます。配列には4つの項目があります。
これは私がアイテムを追加している方法です
for (int i = 0; i<[surveyQuestions count]; i++) {
QuestionData*data=[surveyQuestions objectAtIndex:i];
question_text=data.question_text;
question_type=data.question_type;
coffeeObj.question_text =question_text;
coffeeObj.question_type=question_type;
NSLog(@"Inserted question %@",question_text);
[appDelegate addCoffee:coffeeObj];
}
- (void) addCoffee:(QuestionData *)coffeeObj {
[coffeeObj addCoffee];
[coffeeArray addObject:coffeeObj];
NSLog(@"Succeessfully Added");
}
for(int j=0;j<countmine;j++)
{
QuestionData*data=[appDelegate.coffeeArray objectAtIndex:j];
NSString*myTest=data.question_text;
NSLog(myTest);
QuestionData*dataset=[appDelegate.coffeeArray objectAtIndex:0];
questionTextLabel.text=dataset.question_text;
}
データベースで配列を追加していますが、データベースの各インデックスの最後のエンターエンド値が常に表示されます