Instance Method

countForFetchRequest:error:

Returns the number of objects a given fetch request would have returned if it had been passed to executeFetchRequest:error:.

Declaration

- (NSUInteger)countForFetchRequest:(NSFetchRequest *)request error:(NSError * _Nullable *)error;

Parameters

request

A fetch request that specifies the search criteria for the fetch.

error

If there is a problem executing the fetch, upon return contains an instance of NSError that describes the problem.

Return Value

The number of objects a given fetch request would have returned if it had been passed to executeFetchRequest:error:, or NSNotFound if an error occurs.

See Also

Registering and Fetching Objects

- executeFetchRequest:error:

Returns an array of objects that meet the criteria specified by a given fetch request.

- objectRegisteredForID:

Returns the object for a specified ID, if the object is registered with the context.

- objectWithID:

Returns an object for a specified ID even if the object needs to be fetched.

- existingObjectWithID:error:

Returns the object for the specified ID or nil if the object does not exist.

registeredObjects

The set of objects registered with the context.

- executeRequest:error:

Passes a request to the persistent store without affecting the contents of the managed object context and returns a persistent store result.

- refreshAllObjects

Refreshes all currently registered objects that are associated with this context.

retainsRegisteredObjects

A Boolean value that indicates whether the context keeps strong references to all registered managed objects.