ios - method works n times before playing card game, fails first time afterwards -
i don't know how title question, apologies in advance....
building flash card app. deck of cards can filtered through preferences include/exclude continents. set filter include 1 continent, play game successfully. after finishing deck, decide include second continent. fail.
i'm using tableviewcontroller display 6 continents. prototype cell "right detail". textlabel.text continent name. detailtext.text shows inclusion/exclusion state.
all continents start "include". click on row, toggles on/off.
i can make changes on screen, save settings, come , make more changes without crashing. app only crashes after going through deck 1 time, 10 cards or 100.
error message: -[__nsarrayi addobject:]: unrecognized selector sent instance
-(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; nsstring *name = cell.textlabel.text; if ([[gamesettingsobject sharedinstance].chosencontinents containsobject:name]) { if ([[gamesettingsobject sharedinstance].chosencontinents count]>1) { [[gamesettingsobject sharedinstance].chosencontinents removeobject:name]; cell.detailtextlabel.text = @"exclude"; } } else { [[gamesettingsobject sharedinstance].chosencontinents addobject:name]; cell.detailtextlabel.text = @"include"; } }
any ideas?
you can add objects mutable array. think array becomes nsarray somehow. check that.
Comments
Post a Comment