0

我有一个名为 day 的核心数据实体,它与另一个名为 spot 的名为 spotTable 的实体一对一的关系。

我获取了一天记录,我想访问与我的一天实例相关的现场对象,我像这样访问它:

self.spotTable = [self.day valueForKey:@"spotTable"];

但是当我将 spotTable 对象打印到控制台时,我发现数据有问题:

2012-04-28 13:33:35.161 The Parking Lot[18800:fb03] SpotTable: <NSManagedObject: 0x6b2b820> (entity: Spot; id: 0x6b2b200 <x-coredata://B1F7E573-BCD7-486D-8471-C3D80B891A3B/Spot/p1> ; data: <fault>)

有没有办法从 spotTable 对象中获取数据?

4

1 回答 1

0

A relationship will not be auto-fetched, because you may not need its attributes. You can manually fault it, or you can use -setRelationshipKeyPathsForPrefetching. See the documentation for NSFetchRequest:

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreDataFramework/Classes/NSFetchRequest_Class/NSFetchRequest.html

于 2012-04-29T20:10:44.797 回答