NSFetchedResultsController 错误:索引 248 处获取的对象有一个无序的节名称
尝试这里的解决方案: https://stackoverflow.com/questions/1741093?tab=newest#tab-top
我正在使用瞬态属性和类别解决方案,它似乎一直在工作,直到索引字符开始再次环绕到 A,不知道为什么这样做,只是记录类别/瞬态 getter 为 uppercaseFirstLetterOfName 返回的内容。
我使用 name 属性进行排序,然后将 fetchRequest 上的sectionNameKeyPath 设置为大写FirstLetterOfName。
完整的错误是: NSFetchedResultsController 错误:索引 248 处获取的对象有一个无序的节名称“Y”。对象必须按部分名称排序'
我可能出错的任何想法或者甚至如何追踪问题?
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.
The 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题。
因为排序产生了大写和小写重复,我想但索引标题不是,我得到了乱序的索引/节名称:
只是将其添加到获取中
选择器:@selector(caseInsensitiveCompare:)
所以现在是:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" 升序:YES 选择器:@selector(caseInsensitiveCompare:)];
和作品
饼干杰克!
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!