Re: NSInvocation error when closing a dirty document
Re: NSInvocation error when closing a dirty document
- Subject: Re: NSInvocation error when closing a dirty document
- From: Brad Stone <email@hidden>
- Date: Mon, 12 Apr 2010 14:44:47 -0400
The view that has the combo box, for example, has a Object Controller (called "NoteObjectController) binded to my file's owner (MyDocument : NSDocument) with the Model Key Path to the MOC and the object controller is an entity of my model I created in Core Data. The combo box is binded to the attribute "category" (which is in the entity Note). All of it is just like you said and pretty plain vanilla. Remember, all this binding works fine with a normal save. Just not when I close a dirty document. When I do, the first time I get the invocation error. I don't know **why** I just know it's because the cursor is still in the text fields (any one of them). When I close again it works because the editing ended when the error came up. I'm using "saveDocumentWithDelegate" to check to see if the user is closing a document that needs to be saved so I can end editing before the save begins to head off the error.
I agree with you 100%. I'm learning in Cocoa that if you're doing too much coding you're doing something wrong but I don't know how else to fix it. I'm an experience programmer but only 6-months with Cocoa.
On Apr 12, 2010, at 1:04 AM, Jerry Krinock wrote:
> Brad, you're overriding a method for a strange purpose, and it looks like you're examining an argument to see if it is a certain Apple private selector, and all this is done to achieve something which is quite ordinary, namely binding your data model to a combo box and a text view.
>
> When you find yourself doing something extraordinary to achieve a result which is ordinary, it means that you took a wrong turn somewhere. Anyone else with a similar problem should instead try the object controller I suggested.
>
>
> On 2010 Apr 11, at 14:42, Brad Stone wrote:
>
>> - (void)saveDocumentWithDelegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo {
>>
>> if (didSaveSelector == @selector(_document:shouldClose:contextInfo:)) {
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
On Apr 12, 2010, at 1:04 AM, Jerry Krinock wrote:
> Brad, you're overriding a method for a strange purpose, and it looks like you're examining an argument to see if it is a certain Apple private selector, and all this is done to achieve something which is quite ordinary, namely binding your data model to a combo box and a text view.
>
> When you find yourself doing something extraordinary to achieve a result which is ordinary, it means that you took a wrong turn somewhere. Anyone else with a similar problem should instead try the object controller I suggested.
>
>
> On 2010 Apr 11, at 14:42, Brad Stone wrote:
>
>> - (void)saveDocumentWithDelegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo {
>>
>> if (didSaveSelector == @selector(_document:shouldClose:contextInfo:)) {
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden