Je suis en train de trier un tableau mutable. Pour trier j'utiliser:Comment éviter "NSInternalInconsistencyException" dans iPhone?
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO];
[recent sortUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]];
recent1 = [recent sortedArrayUsingDescriptors:descriptor];
[descriptor release];
Je reçois cette erreur:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'
La ligne
recent1 = [recent sortedArrayUsingDescriptors:descriptor];
Afficher les avertissements
- « argument passant 1 'sortedarrayusingdescritors' de l'objectif distinct c type "et
- "cession d'objectif distinct type c"
Dans mon code, les deux recent
et recent1
sont NSMutable
tableaux. Où vais-je mal?