• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSInvocation error when closing a dirty document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSInvocation error when closing a dirty document (From: Brad Stone <email@hidden>)
 >Re: NSInvocation error when closing a dirty document (From: Jerry Krinock <email@hidden>)
 >Re: NSInvocation error when closing a dirty document (From: Brad Stone <email@hidden>)
 >Re: NSInvocation error when closing a dirty document (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Disappearing prefs
  • Next by Date: Re: Data managment
  • Previous by thread: Re: NSInvocation error when closing a dirty document
  • Next by thread: ObjC question
  • Index(es):
    • Date
    • Thread