0

I have a Core data entity called day that has a to-one relationship with another entity named spot named spotTable.

I fetched a day record and i want to access the spot object related to my day instance i accessed it like this:

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

but when i print the spotTable object to the console i get that the data is faulted:

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>)

is there a way i can fetch the data from the spotTable object?

1 Answers1

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

Jody Hagins
  • 27,943
  • 6
  • 58
  • 87