The code below takes values from an NSMutableArray, takes values from an object, then adds them into another NSMutableArray to be used. What I need to do is add a new row for each item in the NSMutableArray *options but it crashes saying:
[__NSSingleObjectArrayI length]: unrecognized selector sent to instance
If I comment out the code in the for (int i = 0; i < options.count; i++) and just leave the NSLog(@"FIELD) it shows the correct values. Any ideas?
LFFormSectionLabel *sectionLabel = [LFFormSectionLabel new];
[sectionLabel addValue:header forSEL:@selector(setText:)];
[vc addSection:sectionLabel];
NSMutableArray *options = [[NSMutableArray alloc] init];
for (NSDictionary *item in self.surveydata) {
NSString *addressfield = [item objectForKey:@"address_option"];
[options addObject:addressfield];
}
for (int i = 0; i < options.count; i++) {
NSString *field = [options objectAtIndex:i];
LFFormRowTextField *rowTextField = [LFFormRowTextField new];
rowTextField.key = @"name";
[rowTextField addValue:field forSEL:@selector(setPlaceholder:)];
[sectionLabel addRow:rowTextField];
NSLog(@"FIELD: %@", field);
}
self.surveydata. But it appears that[item objectForKey:@"address_option"]returns anNSArray, not anNSString. - rmaddy