ios - [__NSCFString count]: unrecognized selector sent to instance -


i have been searching issue last few days.

in file .h put in interface:

nsmutablearray *newscount; @property (nonatomic, retain) nsmutablearray *newscount; 

and in file .m have wrore piece of code.

i have alloc in view appear method:

- (void)viewwillappear:(bool)animated{ self.newscount = [[nsmutablearray alloc] init]; }      - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {         return [self.newscount count];        //    return 5;     }      - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @"cell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {         cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];     }      // configure cell.     cell.textlabel.text = [nsstring stringwithformat:@"- %@",[[newscount objectatindex: indexpath.row] objectforkey:@"related_caption"]];     [cell.textlabel setfont:[uifont fontwithname:@"helvetica" size:13]];     cell.textlabel.linebreakmode = uilinebreakmodewordwrap;     cell.textlabel.numberoflines = 2;     cell.textlabel.textcolor = [uicolor graycolor];     return cell;     } 

how setting self.newscount?

either not putting array self.newscount, or (more likely) setting "newscount" without retaining it.

are using arc? if not, should be.


Comments