NSSavePanel: Another sandbox issue
NSSavePanel: Another sandbox issue
- Subject: NSSavePanel: Another sandbox issue
- From: Graham Cox <email@hidden>
- Date: Thu, 31 May 2012 09:50:20 +1000
In my app I put up a save panel to save a file in a particular place within my ~/Library/Application Support folder. When not sandboxed, this works fine. When sandboxed, the URL that is set in the panel is correct (it's inside the sandbox now), but the save panel doesn't appear. In fact, it acts as if it's visible, but it's not, so my app enters a state that the user cannot recover it from - I have to stop it in the debugger or Force Quit.
The stack trace is:
#0 0x00007fff85ba667a in mach_msg_trap ()
#1 0x00007fff85ba5d71 in mach_msg ()
#2 0x00007fff897cb50c in __CFRunLoopServiceMachPort ()
#3 0x00007fff897d3c74 in __CFRunLoopRun ()
#4 0x00007fff897d3486 in CFRunLoopRunSpecific ()
#5 0x00007fff897e319f in CFRunLoopRun ()
#6 0x00007fff89e90bdc in -[NSRemoteSavePanel beginSheetModalForWindow:completionHandler:] ()
#7 0x00000001000a7eae in -[GCOrteliusDocument(Templates) saveCopyAsTemplateAction:] at /Users/grahamcox/Projects/Artboard/Artboard/Source/Code/GCOrteliusDocument+Templates.m:310
#8 0x00007fff8982e70d in -[NSObject performSelector:withObject:] ()
#9 0x00007fff8af55f7e in -[NSApplication sendAction:to:from:] ()
The code is very simple:
NSSavePanel* savePanel = [NSSavePanel savePanel];
<define completion handler - omitted for brevity>
[savePanel setCanCreateDirectories:YES];
[savePanel setCanSelectHiddenExtension:NO];
[savePanel setExtensionHidden:YES];
[savePanel setDirectoryURL:[[self class] userTemplatesURL]]; // URL differs if sandboxed/not sandboxed
[savePanel beginSheetModalForWindow:[self windowForSheet] completionHandler:completionHandler];
Anyone else come across this issue? My understanding is that with sandboxing, the save panel is a bit more involved since it has to open up holes in the sandbox on behalf of the user, but in this case it's actually inside the sandbox.
--Graham
_______________________________________________
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