Oh, sorry, here is the message in the Console: *** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to instance 0x3a11d70 Serious application error. Exception was caught during Core Data change processing: *** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to instance 0x3a11d70 with userInfo (null) *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to instance 0x3a11d70' Stack: ( ...
On 25/12/2009, at 16:40 , Brian Bruinewoud wrote: > This has me totally stumped. > > I have an app that contains (currently) three Entities: > Person > Deed; and > DeedDoneByPerson > > Deed is effectively a template object. I'll probably re-do the object model > but I want to understand what's going on with this bug first. > > Deeds can be good or not and have a degree of goodness. > > Here is the code that creates a new deed and deedDoneByPerson: > > NSManagedObject *newDeed = [ NSEntityDescription > insertNewObjectForEntityForName: @"Deed" > > inManagedObjectContext: context ]; > > int score; > if( self.isGood ) score = sender.tag; > else score = - sender.tag; > > [newDeed setValue: self.deedName.text > forKey: @"deedName" ]; > [newDeed setValue: [ NSNumber numberWithBool: self.isGood ] > forKey: @"isGood" ]; > [newDeed setValue: [ NSNumber numberWithInt: score ] > forKey: @"points" ]; > > NSManagedObject *newDeedDoneByPerson = [ NSEntityDescription > insertNewObjectForEntityForName: @"DeedDoneByPerson" > > inManagedObjectContext: context ]; > > [newDeedDoneByPerson setValue: newDeed > forKey: @"deedDone" ]; > [newDeedDoneByPerson setValue: selectedPerson > forKey: @"byPerson" ]; > [newDeedDoneByPerson setValue: [ NSNumber numberWithBool: self.isGood > ] forKey: @"isGood" ]; > // let 'points' and 'instances' default > > FYI2( @":: Create new deed [...@]", self.deedName.text ); > NSError *error; > if (![context save:&error]) //!!!!!!! CRASHES HERE !!!!!!!! > { > NSLog(@"!! Unresolved error %@, %@", error, [error userInfo]); > abort(); > } > > > The following scenarios work: > With a fresh app (deleted from the simulator and re-installed), create a > person and add any number of bad deeds to that person - they are displayed > correctly and sqlite has the expected contents. > With a fresh app (deleted from the simulator and re-installed), create a > person and add any number of good deeds to that person - they are displayed > correctly and sqlite has the expected contents. > With a fresh app (deleted from the simulator and re-installed), create a > person and add any number of bad deeds to that person - they are displayed > correctly and sqlite has the expected contents. Then create another person > and add any number of good deeds to that person - they are displayed > correctly and sqlite has the expected contents > > The following scenario does NOT work: > With a fresh app (deleted from the simulator and re-installed), create a > person and add a bad deed to that person then attempt to add a good deed. BOOM > > Stack trace: > #0 0x93affedb in objc_msgSend > #1 0x939f4b6c in ?? > #2 0x0001763a in _nsnote_callback > #3 0x01d34005 in _CFXNotificationPostNotification > #4 0x00014ef0 in -[NSNotificationCenter > postNotificationName:object:userInfo:] > #5 0x01ba717d in -[NSManagedObjectContext(_NSInternalNotificationHandling) > _postObjectsDidChangeNotificationWithUserInfo:] > #6 0x01c06763 in -[NSManagedObjectContext(_NSInternalChangeProcessing) > _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] > #7 0x01b8b5ea in -[NSManagedObjectContext(_NSInternalChangeProcessing) > _processRecentChanges:] > #8 0x01bc1728 in -[NSManagedObjectContext save:] > #9 0x00005434 in -[NewDeedViewController commit:] at > NewDeedViewController.m:131 <------------------- CODE ABOVE > #10 0x00298459 in -[UIApplication sendAction:to:from:forEvent:] > #11 0x002fbba2 in -[UIControl sendAction:to:forEvent:] > #12 0x002fddc3 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] > #13 0x002fcb0f in -[UIControl touchesEnded:withEvent:] > #14 0x002b1e33 in -[UIWindow _sendTouchesForEvent:] > #15 0x0029b81c in -[UIApplication sendEvent:] > #16 0x002a20b5 in _UIApplicationHandleEvent > #17 0x0252cef1 in PurpleEventCallback > #18 0x01d40b80 in CFRunLoopRunSpecific > #19 0x01d3fc48 in CFRunLoopRunInMode > #20 0x0252b7ad in GSEventRunModal > #21 0x0252b872 in GSEventRun > #22 0x002a3003 in UIApplicationMain > #23 0x00001cb4 in main at main.m:14 > > I don't understand how the value of 'score' breaks things. If I get rid of > the negation in this code: > int score; > if( self.isGood ) score = sender.tag; > else score = - sender.tag; > everything works fine: adding good and bad to the same person is acceptable. > > Any suggestions on what to investigate? > > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please 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/brian%40darknova.com > > This email sent to br...@darknova.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com