开发者

Core Data problem in iOS

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://01F71B开发者_高级运维1D-B468-4FCC-B083-8254F375ADE5/MyEntity/p1> ; data: <fault>)

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

Is the data corrupted ?

Thanks


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"


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜