user218404
user218404

Reputation:

executeFetchRequest:error

NSError *error = nil;

NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];

if (mutableFetchResults == nil) 
    {
        // Handle the error.
    }

// Set self's events array to the mutable array, then clean up.
[self setEventsArray:mutableFetchResults];
[mutableFetchResults release];

these code gives a runtime error 'executeFetchRequest:error: A Fetch request must have an entity.' can any one help to solve this error

Upvotes: 1

Views: 5069

Answers (1)

bbum
bbum

Reputation: 162722

Yes, but you'll need to post the code where you actually create the fetch request because that error message quite precisely indicates that you haven't configured the fetch request correctly.

In particular, you need to call setEntity: on the fetch request.

Also, it is atypical to create a mutable copy of a set of fetch requests. Instead, simply set your object's fetch results to the returned array (or a -copy of the array -- immutable copies of immutable arrays are basically free).

Upvotes: 5

Related Questions