ios - NSFetchedResultController and NSSortDescriptor with comparison block -
i've tried implement nsfetchedresultcontroller
giving nssortdescriptor
comparison block, raises exception saying doesn't support it.
nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc] initwithkey:@"alarmtime" ascending:yes comparator:^nscomparisonresult(id obj1, id obj2) { nsdate * obj1date = [weakself returnclosestvaliddate:(nsdate*) obj1]; nsdate * obj2date = [weakself returnclosestvaliddate:(nsdate*) obj2]; return [obj2date compare:obj1date]; }];
i need that, because i'm sorting alarms repeat in time , property alarmtime date there fire time , date corresponding creation date. since need show them in cronological order other alarms, if not correct date on top (or bottom) of list.
there way achieve this? thought resort them after sort descriptor mandatory fetched controller.
Comments
Post a Comment