开发者

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


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).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜