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: Jerry Krinock <email@hidden>
- Date: Sat, 10 Apr 2010 18:12:45 -0700
On 2010 Apr 10, at 12:43, Brad Stone wrote:
> I have a strange bug that I've been tracking for a while and I'd like the benefit of your experience. It happens with I close a window that needs to be saved.
>
> When closing a dirty Core Data NSPersistentDocument I get the following error between the "Do you want to save" sheet and the save panel:
>
> [58341:a0f] +[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil
> If I make the document dirty by typing text into any of the combo boxes or the text view I get the above error after I press the "Save" button on the "Do you want to saveā¦" sheet
Well, as usual, there are two routes to attack this. I was going to say to try either, but in this case, since you know it has something to do with the combo boxes or text view, I'd try Route 2 first.
Route 1 - The Scientist. Use debugging information to try and narrow down where the problem might be. To do this, set breakpoints on the following symbols. (Some are irrelevant for this case, but you should have these handy in any project):
handleFailureInMethod:object:file:lineNumber:description:
objc_exception_throw
malloc_printf
-[NSException raise]
handleFailureInFunction:file:lineNumber:description:
raise:format:arguments:
Then "Debug - Breakpoints On". Reproduce your problem, and the debugger will stop where the exception occurs. Look at the call stack and think real hard. To get more food for thought, in your Xcode documentation browser, search for and open the "Document-Based Applications Overview". Click on the chapter, "Message Flow in the Document Architecture", then scroll down to and feast your eyes upon Figure 6.
Route 2 - The Engineer. Figure out what you're doing that's different than what everyone else is doing, and change your design toward the more conventional until the problem goes away. You didn't say much about how you're binding these combo boxes and text view. Look at Apple's DepartmentAndEmployees sample code, in the MyDocument.nib, and note how the DepartmentController, an NSObjectController, is interposed between the user interface and the data model. One reason to do that is so that your data model will be updated when the window is closed, and then you won't need to do this:
> have the bindings set, in IB, to "Continuously Updates Value".
which is definitely *not* conventional. (Again, look at the bindings in DepartmentAndEmployees MyDocument.nib.) Other reasons may be related to your current problem.
_______________________________________________
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