When the following code runs on iPhone (ios 3.1), the number of selected objects after deletion is less than before deletion. But on the iPad (ios 3.2), the count remains unchanged. This inconsistency caused the iPad to crash, since fetchedObjects is called in another place of the code shortly after the deletion and the calling code, trusting the account, tries to access the properties of the newly deleted objects, which leads to an NSObjectInaccessibleException error (see below). The fix was to use this commented out call to performFetch, which when you execute the second call to fetchObjects gives the same result as on an iPhone without it. My question is: why does the iPad produce different results than the iPhone? This is the second of these differences that I recently discovered and published.
-(NSError*)deleteObject:(NSManagedObject*)mo; { NSLog(@"\n\nNum objects in store before delete: %i\n\n", [[self.fetchedResultsController fetchedObjects] count]); [self.managedObjectContext deleteObject:mo];
(Full NSObjectInaccessibleException: "Application terminated due to an uncaught exception" NSObjectInaccessibleException ", reason:" CoreData could not execute error for "0x1dcf90"
iphone ipad core-data
Alyoshak
source share