Core Data problem in iOS

1.1k Views Asked by At

I tried to fetch the records which are stored in the core data, and I logged the fetch objects with NSLog and they are as below.

<NSManagedObject: 0x4e31920> (entity: MyEntity; id: 0x4e30a80 <x-coredata://01F71B1D-B468-4FCC-B083-8254F375ADE5/MyEntity/p1> ; data: <fault>)

What is the meaning of "data: <fault>" ?

Is the data corrupted ?

Thanks

2

There are 2 best solutions below

0
Leniel Maccaferri On

No. Data is not corrupted. Take a look here for a complete description of what is happening:

Core-Data: NSLog output Does Not Show "Fields"

0
J2theC On

When fetching the data, you can ask your fetchRequest to respond with data non-faulted by calling

[fetchRequest setReturnObjectsAsFaults:NO];

Here's some more details about faulting:

Faulting

Managed objects typically represent data held in a persistent store. In some situations a managed object may be a “fault”—an object whose property values have not yet been loaded from the external data store—see “Faulting and Uniquing” for more details. When you access persistent property values, the fault “fires” and the data is retrieved from the store automatically. This can be a comparatively expensive process (potentially requiring a round trip to the persistent store), and you may wish to avoid unnecessarily firing a fault (see “Faulting Behavior”).

Although the description method does not cause a fault to fire, if you implement a custom description method that accesses the object’s persistent properties, this will cause a fault to fire. You are strongly discouraged from overriding description in this way.

There is no way to load individual attributes of a managed object on an as-needed basis. For patterns to deal with large attributes, see “Large Data Objects (BLOBs).”

More information can be found here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdManagedObjects.html#//apple_ref/doc/uid/TP40003397-SW2