Hi, I've got a pop-up button that has a binding of selectedObject to a Core Data relationship inside an NSCollectionViewItem's view. For some reason, occasionally encodeWithCoder: is called upon this item, here's a partial backtrace showing the relevant calls:
#0 -[GreenwoodPieceType encodeWithCoder:] (self=0x16b200, _cmd=0x9240e83c, coder=0x16f200) at /Users/Greg/Documents/Greenwood2/GreenwoodPieceType.m:26 #1 0x95584d2d in _encodeObject () #2 0x931091cc in -[NSMenuItem encodeWithCoder:] () #3 0x95584d2d in _encodeObject () #4 0x955f542d in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] () #5 0x955a4f47 in -[NSArray(NSArray) encodeWithCoder:] () #6 0x95584d2d in _encodeObject () #7 0x93107ac8 in -[NSMenu encodeWithCoder:] () #8 0x95584d2d in _encodeObject () #9 0x9315a6f7 in -[NSPopUpButtonCell encodeWithCoder:] () #10 0x95584d2d in _encodeObject () #11 0x92e3fe6d in -[NSControl encodeWithCoder:] () #12 0x95584d2d in _encodeObject () #13 0x955f542d in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] () #14 0x955a4f47 in -[NSArray(NSArray) encodeWithCoder:] () #15 0x95584d2d in _encodeObject () #16 0x92e3ef8c in -[NSView encodeWithCoder:] () #17 0x95584d2d in _encodeObject () #18 0x93304943 in -[NSCollectionViewItem encodeWithCoder:] () #19 0x95584d2d in _encodeObject () #20 0x93304db3 in -[NSCollectionViewItem copyWithZone:] () #21 0x905350ba in -[NSObject copy] () #22 0x93308082 in -[NSCollectionView newItemForRepresentedObject:] () #23 0x933089a0 in -[NSCollectionView _computeTargetItemsByRegenerating:] () #24 0x9330b5ef in -[NSCollectionView _contentChanged:regenerate:] () #25 0x93307e35 in -[NSCollectionView setContent:] () #26 0x932f1cd2 in -[NSCollectionViewBinder _updateContent] () #27 0x932f1d80 in -[NSCollectionViewBinder _observeValueForKeyPath:ofObject:context:] () #28 0x955e2b0e in NSKVONotify () #29 0x955730a5 in -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] () #30 0x92c2a70a in -[NSController _notifyObserversForKeyPath:change:] () #31 0x92c2a60b in -[NSController didChangeValueForKey:] () #32 0x92e46920 in -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] () #33 0x92e49780 in -[NSArrayController _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:] () #34 0x92e446b6 in -[NSArrayController setContent:] () #35 0x92fe4ad9 in -[NSArrayController(NSManagedController) _performFetchWithRequest:merge:error:] () #36 0x93141a13 in -[NSObjectController(NSManagedController) fetchWithRequest:merge:error:] () #37 0x93141a99 in -[NSObjectController(NSManagedController) _executeFetch:didCommitSuccessfully:actionSender:] () #38 0x9327103e in _NSSendCommitEditingSelector () #39 0x93057d54 in -[NSController _controllerEditor:didCommit:contextInfo:] () As you can see, it is attempting to copy the NSCollectionViewItem in order to set it up, but is also attempting to copy the bound object, which is a core data object and so I am getting a selector not found exception because NSManagedObject does not conform to NSCoding. Specifically, the pop up button has these IB bindings: Content Values => [array controller].arrangedObjects.name Selected Object => [NSCollectionViewItem].representedObject.pseudoGroupType where pseudoGroupType is a transient optional relationship that abstracts the groupType relationship. I use this to capture changes to groupType so that I can create or delete related core data items. Would it be better to simply do a target/action between the pop-up button and the NSCollectionViewItem subclass and perform these changes after the value has changed? Why is Cocoa trying to code the NSManagedObject that is the representedObject? Thanks, Greg _______________________________________________ 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