Keypath <transientproperty> não encontrado na entidade
Eu quero mostrar uma data formatada no cabeçalho da seção de uma visão de tabela ..
Eu usei o seguinte código. Mas lançando uma exceção*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath dateSectionIdentifier not found in entity <NSSQLEntity Expense id=1>'
.
acho que a exceção está chegando ao adicionar um descritor de classificação.
NSMutableArray *sortDescriptors = [[NSMutableArray alloc] initWithCapacity:20];
NSSortDescriptor *mainSortDescriptor = [[NSSortDescriptor alloc] initWithKey:dateSectionIdentifier ascending:NO];
[sortDescriptors addObject:mainSortDescriptor];
[fetchRequest setSortDescriptors:sortDescriptors];
//Expense.h
NSString *dateSectionIdentifier;
//Expense.m
@dynamic dateSectionIdentifier
-(NSString *)dateSectionIdentifier{
[self willAccessValueForKey:@"dateSectionIdentifier"];
NSString *tempDate = [self primitiveDateSectionIdentifier];
[self didAccessValueForKey:@"dateSectionIdentifier"];
if(!tempDate){
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"d MMMM yyyy"];
tempDate = [dateFormatter stringFromDate:[self date]];
[self setPrimitiveDateSectionIdentifier:tempDate];
[dateFormatter release];
}
return tempDate;
}