开发者

NSFetchedResultsChangeInsert reported when only updates are taking place

I have a class that acts as a NSFetchedResultsControllerDelegate which is receiving messages to -(void)controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: with change type NSFetchedResultsChangeInsert, but the actual object which is the subject has with certainty not been newly inserted, only updated. So I would expect to get a change message with type NSFetchedResultsChangeUpdate, should I not?

If i check the value of isInserted on the object, it yields false (as expected from the logic in my program). So my question is, why is this reported as an insert when it is only a change/update?

They only thing I can think of is that part of the changes that are 开发者_JAVA技巧taking place is that objects of another entity type are inserted with relationships to objects of the entity type that the NSFetchedResultsController is set up to fetch.


Because the call to the delegate occurs after the save which at that point the object is no longer in a isInserted state. It is now successfully saved and the insert is finished.

-isInserted returns YES when the object is newly inserted but not yet saved.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜