I keep getting a unrecognized selector when I try to add an object to my mutable array, I'm trying to add and remove items to a mutable array when a cell is selected in my tableview, here is my code:
@interface SomeViewController
@property (nonatomic, strong) NSMutableArray *selectedItems;
@end
View did load:
-(void)viewDidLoad {
[super viewDidLoad];
self.selectedItems = [[NSMutableArray alloc] init];
}
Selecting cell:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MyCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[self.selectedItems addObject:[NSString stringWithFormat:@"%@", cell.contactID]];
Contact Id attribute on MyCell file is:
@property (strong, nonatomic) NSString *contactID;
I keep getting this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM _fastCStringContents:]: unrecognized selector sent to instance 0x7fc3dd1091b0'