【问题标题】:unknow object retrieve from core data从核心数据中检索到的未知对象
【发布时间】:2011-01-06 11:34:31
【问题描述】:

这是一个 fetchrequest 的 NSDictionnary 结果:

    {
    "appelation_vin" = Bordeaux;
    "id_dom" = 134;
    "vin_domaine" = "0x5b33ce0 <x-coredata://41A4D74E-EF4D-41DA-96F9-7F15DAE46403/domaine/p134>";
},

这就是秘密,vin_domaine 应该是两个表之间关系的值,所以我知道它应该是的对象类型(domaine),但我不明白为什么它没有被 core_data 识别...

这里有很多帮助的请求

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"vin" inManagedObjectContext:managedObjectContext]];

[fetchRequest setReturnsObjectsAsFaults:NO];

[fetchRequest setResultType:NSDictionaryResultType];
[fetchRequest setReturnsDistinctResults:YES];
[fetchRequest setPropertiesToFetch:[NSArray arrayWithObjects:@"appelation_vin",@"id_dom",@"vin_domaine",nil]];


NSString *mysearch= [NSString stringWithFormat:@"appelation_vin= '%@'",appelation];
NSPredicate *predicate = [NSPredicate predicateWithFormat:mysearch,10];
[fetchRequest setPredicate:predicate];
[fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:@"domaine"]];

谢谢帮助!

【问题讨论】:

    标签: iphone objective-c core-data


    【解决方案1】:

    您是否将domaine 实体设置为您期望的类?可以在 XCode 的 *xcdatamodel 文件中设置(example)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多