本文介绍了coredata 错误,因为 sectionNameKeyPath 或 NSFetchedResultsController 中的分组数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2011-12-28 10:52:13.633 BadgerNew[663:707] CoreData: error: (NSFetchedResultsController) object <Business: 0x628c8e0> (entity: Business; id: 0x628c870 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/Business/p88> ; data: {
    Aliases = "<relationship fault: 0x6219950 'Aliases'>";
    Bookmark = 0;
    Building = nil;
    City = "0x56531a0 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/City/p1>";
    Distance = "104.6926812925746";
    Districts =     (
        "0x63bcb30 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/District/p1>"
    );
    Email = nil;
    ID = 74318;
    Images = "<relationship fault: 0x621a130 'Images'>";
    InBuildingAddress = nil;
    LatitudeLongitude = "0x565c2e0 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/LatitudeLongitude/p81>";
    Like = 0;
    OpeningHour = nil;
    Phones = "<relationship fault: 0x62196b0 'Phones'>";
    Price = 0;
    Promotions = "<relationship fault: 0x6219630 'Promotions'>";
    Rating = "0x565e800 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/Rating/p81>";
    Reviews =     (
    );
    Street = "Jl. Duri Raya 73";
    Tags =     (
        "0x63c38b0 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/Tag/p74>"
    );
    Tenants = "<relationship fault: 0x62194c0 'Tenants'>";
    TimeStamp = nil;
    Title = "Toko Guna Bangunan Jaya";
    URLs = "<relationship fault: 0x6219440 'URLs'>";
    Website = nil;
    Zip = 11510;
    pinAndLineNumber = 1;
    updated = 0;
}) returned nil value for section name key path 'Building.Title'. Object will be placed in unnamed section

当我想在 NSFetchedResultsController 使用 sectionNameKeyPath:@"Building.Title" 对数据进行分组时,会出现此错误日志.像这样

this error log is appear when I want to grouping data at NSFetchedResultsController use sectionNameKeyPath:@"Building.Title". something like this

NSFetchedResultsController * FRC=[[[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:[ThreadClass managedObjectContext] sectionNameKeyPath:@"Building.Title" cacheName:Nil]autorelease];

谁能帮我解决这个问题,Building can be nil?因为我想展示类似

anyone can help me to fix this with Building can be nil? because I want to show something like

推荐答案

我想出了答案.如果按建筑物分组,则还必须按建筑物或建筑物位置排序.排序的顺序必须与分组的顺序相匹配.因此,您不能出现同一组"中的物品分开排序的情况.

I figured the answer out. If you group by building you must also sort by building or building location. The order of your sorting must match the order of your grouping. So you cannot have a situation where items on the same "group" to have separate ordering.

这篇关于coredata 错误,因为 sectionNameKeyPath 或 NSFetchedResultsController 中的分组数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:48