Core data fetch only returns unique managed objects
I execute a core data fetch which specifies a predicate as follows:
NSPredicate *predicate = [NSPredicate predic开发者_如何学编程ateWithFormat:@"identifier IN %@", favoritesIDs];
When there are duplicate items in the favoriteIDs array, the fetch request only returns 1 managed object. How can I ensure that more than one instance is fetched? Thank you.
Executing a fetch request on a context will never return more than one instance for any given managed object context; you would have to manage the number of virtual instance in some other fashion. In fact, any faulted object that you previously obtained from a context will result in the same instance of that object in later requests executed against the context (so you can end up with the same instance of an object even from multiple request executions).
精彩评论