ios - enumeration values 'NSFetchedResultsChangeMove' and NSFetchedResultsChangeUpdate' not handled in switch -
i warning: enumeration values 'nsfetchedresultschangemove' , nsfetchedresultschangeupdate' not handled in switch
any ideas?
- (void)controller:(nsfetchedresultscontroller *)controller didchangesection:(id <nsfetchedresultssectioninfo>)sectioninfo atindex:(nsuinteger)sectionindex forchangetype:(nsfetchedresultschangetype)type { switch(type) { case nsfetchedresultschangeinsert: [self.tableview insertsections:[nsindexset indexsetwithindex:sectionindex] withrowanimation:uitableviewrowanimationfade]; break; case nsfetchedresultschangedelete: [self.tableview deletesections:[nsindexset indexsetwithindex:sectionindex] withrowanimation:uitableviewrowanimationfade]; break; } } - (void)controllerdidchangecontent:(nsfetchedresultscontroller *)controller { [self.tableview endupdates]; } thanks in advance
the compiler knows nsfetchedresultschangetype has 4 possible values, code handles 2 of those. if know sure other 2 not occur, can ignore warning. safest include code handle these other values, either nothing or nslog see if occur. add
case nsfetchedresultschangemove: nslog(@"a table item moved"); break; case nsfetchedresultschangeupdate: nslog(@"a table item updated"); break; into switch statement. edit: having checked docs, see these 2 values not used section changes, can either ignore warning or add null case statements along above lines suppress warning.
Comments
Post a Comment