开发者

NSFetchedResultsController ERROR: The fetched object at index 248 has an out of order section name

trying the solution here: https://stackoverflow.com/questions/1741093?tab=newest#tab-top

I'm using a transient property and the category solution and it seems to be working right up until the index char starts to wrap around to the A's again, not sure why it's doing that, just logging what the category/transient getter is returning for uppercaseFirstLetterOfName.

I'm sorting using the name property and then setting sectionNameKeyPath on the fetchRequest to uppercaseFirstLetterOfName.

Th开发者_如何学Goe full error is: NSFetchedResultsController ERROR: The fetched object at index 248 has an out of order section name 'Y. Objects must be sorted by section name'

Any ideas where I might have gone wrong or how to even track down the problem?


I found the problem. Because the sort was producing caps and lower case dups I suppose but the indextitles weren't I got that out of order index/section name:

just added this to the fetch selector:@selector(caseInsensitiveCompare:)

so it is now: NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)];

and works cracker jack!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜