10 Dec 2012, 09:47
Generic-user-small

Markus Dommann (1 post)

I opened RecipesV1 with Xcode 4.5.2 compiled and run, pressed the button ‘+’ and got this:

CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0] with userInfo (null)

I could fix this by checking the indexPaths before using them in controller:didChangeObject: in PPRMasterViewController.m

NSArray *newArray = nil;
if (newIndexPath) {
  newArray = [NSArray arrayWithObject:newIndexPath];    
}
NSArray *oldArray = nil;
if (indexPath) {
  oldArray = [NSArray arrayWithObject:indexPath];
}

This way the app doesn’t crash anymore on adding the first recipe or canceling the same addition.

01 Feb 2013, 17:16
Generic-user-small

Dave Zohrob (1 post)

Thanks – you saved me a lot of frustration.

Author, this should be included in the code!

  You must be logged in to comment