Further information: when the user selects to duplicate, - 
(BOOL)readFromURL:ofType:error: is called with the error argument being an 
NSDocumentErrorRecoveryAttempter object. 

I don't know why this is happening.

Would it be save for me to do something like this:

    if (*outError && [*outError 
isKindOfClass:NSClassFromString(@"NSDocumentErrorRecoveryAttempter")]) {
        *outError = nil;
    }

?

>From a practical perspective, it seems to work, but I just don't get why I'm 
>getting the NSDocumentErrorRecoveryAttempter object passed in to my file 
>reading method.

On 17/01/2012, at 12:07 PM, Gideon King wrote:

> Hi everyone, I'm trying to resolve a very strange problem. In my document I 
> have implemented willPresentError:, and on Lion when someone opens a locked 
> document and tries to edit it, an error is produced, which I forward to 
> super, which gives people the option of unlocking, canceling, or duplicating. 
> 
> If they choose to duplicate, I get another call to willPresentError, but this 
> time the supposed error is not an NSError at all, but instead an 
> NSDocumentErrorRecoveryAttempter object.
> 
> I have no idea how this could happen, and the stack trace doesn't seem to 
> help. Any ideas where to look?
> 
> #0  -[NMPersistentDocument willPresentError:] (self=0x105715850, 
> _cmd=0x7fff8cebd8da, error=0x10d1c5ff0) at 
> /Users/gideon/Development/svn/trunk/mac/Source/NMPersistentDocument.m:598
> #1  0x00007fff8c9e6780 in -[NSDocument 
> presentError:modalForWindow:delegate:didPresentSelector:contextInfo:] ()
> #2  0x00007fff8c9ed167 in -[NSDocument _presentError:thenContinue:] ()
> #3  0x00007fff8ce60171 in __-[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]_block_invoke_3
>  ()
> #4  0x00007fff8c9fa6b8 in __-[NSDocument 
> _errorForAutosavingSafetyConcern:userInfo:]_block_invoke_1 ()
> #5  0x00007fff8ce5fd3e in -[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]
>  ()
> #6  0x00007fff8ce5fdf2 in -[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]
>  ()
> #7  0x00007fff8c8eeb6e in __-[NSApplication(NSErrorPresentation) 
> presentError:modalForWindow:delegate:didPresentSelector:contextInfo:]_block_invoke_3
>  ()
> #8  0x00007fff8c8f5be4 in -[NSApplication(NSErrorPresentation) 
> _something:wasPresentedWithResult:soContinue:] ()
> #9  0x00007fff8c8e5e7d in -[NSAlert didEndAlert:returnCode:contextInfo:] ()
> #10 0x00007fff8c8f27d7 in -[NSApplication endSheet:returnCode:] ()
> #11 0x00000001006e30d8 in -[OAApplication endSheet:returnCode:] ()
> #12 0x00007fff8c8e5d43 in -[NSAlert buttonPressed:] ()
> #13 0x00007fff904d3a1d in -[NSObject performSelector:withObject:] ()
> #14 0x00007fff8c741710 in -[NSApplication sendAction:to:from:] ()
> #15 0x00000001006e3204 in -[OAApplication sendAction:to:from:] ()
> #16 0x00007fff8c741642 in -[NSControl sendAction:to:] ()
> #17 0x00007fff8c74156d in -[NSCell _sendActionFrom:] ()
> #18 0x00007fff8c740a30 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] ()
> #19 0x00007fff8c7c08e0 in -[NSButtonCell 
> trackMouse:inRect:ofView:untilMouseUp:] ()
> #20 0x00007fff8c73f63a in -[NSControl mouseDown:] ()
> #21 0x00007fff8c70a0e0 in -[NSWindow sendEvent:] ()
> #22 0x00007fff8c6a268f in -[NSApplication sendEvent:] ()
> #23 0x00000001006dce7f in -[OAApplication sendEvent:] ()
> #24 0x00007fff8c638682 in -[NSApplication run] ()
> #25 0x00000001006d9bff in -[OAApplication run] ()
> #26 0x00007fff8c8b780c in NSApplicationMain ()
> #27 0x0000000100001b82 in main (argc=5, argv=0x7fff5fbffaa8) at 
> /Users/gideon/Development/svn/trunk/mac/Source/main.m:11
> 
> 
> Thanks
> 
> Gideon
> 
> 
> 
> 
> 
> 
> 
> 

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to