Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data fetch request crashes the app



I am trying to fetch an array of managed objects but sometimes it crashes my app.

--------
NSEntityDescription * entity = [NSEntityDescription entityForName: (an entity name)
inManagedObjectContext: managedObjectContext];


NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity: entity];
[fetchRequest setPredicate: (a predicate)];

NSArray * fetchedMOArray;
NSError * error;
fetchedMOArray = [managedObjectContext executeFetchRequest: fetchRequest
					error: &error];
--------

The code usually works, but when I remove a managed object through an
NSArrayController (removeObject:) before executing this code, the app is crashed
when the last line (executeFetchRequest: error:) is executed.


My questions are that are there any timings or conditions that fetch request is not allowed,
and if there are, how can I avoid them.


Thank you.
Chataka

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.