解释在这里
这里是中文的详细解释
http://blog.csdn.net/meegomeego/article/details/17654947
需要参考的官方文档:
从上面的文章中,你应该已经明白了fault的含义。这个单词的直接翻译是缺点,不足。在这里,就代表着一种不完全,部分获得的含义。
看了这个问题,我们再看看我今天用到的2个函数,用第一个函数时,程序就报错了,之后,改用第二个,解决了问题。
/* returns the object for the specified ID if it is already registered, otherwise it creates a fault corresponding to that objectID. It never returns nil, and never performs I/O. The object specified by objectID is assumed to exist, and if that assumption is wrong the fault may throw an exception when used. */ - (NSManagedObject *)objectWithID:(NSManagedObjectID *)objectID; /* returns the object for the specified ID if it is already registered in the context, or faults the object into the context. It might perform I/O if the data is uncached. If the object cannot be fetched, or does not exist, or cannot be faulted, it returns nil. Unlike -objectWithID: it never returns a fault. */ - (NSManagedObject*)existingObjectWithID:(NSManagedObjectID*)objectID error:(NSError**)error NS_AVAILABLE(10_6, 3_0);
我们在来看看上面这2个函数的不同之处。
先看一下什么叫做registered:
All objects fetched from an external store are registered in a context together with a global identifier (an instance of NSManagedObjectID
) that’s used to uniquely identify each object to the external store.