Re: NSSavePanel runModal isn't working in sandbox?
Re: NSSavePanel runModal isn't working in sandbox?
- Subject: Re: NSSavePanel runModal isn't working in sandbox?
- From: Rainer Brockerhoff <email@hidden>
- Date: Wed, 06 Jun 2012 14:13:13 -0300
On Jun 6, 2012, at 13:08 , email@hidden wrote:
> Date: Wed, 06 Jun 2012 14:50:17 +1000
> From: Graham Cox <email@hidden>
> To: Samuel Williams <email@hidden>
> Message-ID: <email@hidden>
>
> Are you aware that this class is riddled with severe bugs under the current sandbox implementation?
>
> The dev forums will reveal more details.
>
> Also, NSSavePanel doesn't inherit from NSPanel under sandboxing, so if you are expecting to use inherited methods, they don't work.
> ...
> On 06/06/2012, at 1:41 PM, Samuel Williams wrote:
>>
>> I'm having trouble with NSSavePanel runModal in a sandbox:
>>
>> NSSavePanel * savePanel = [NSSavePanel savePanel];
>> savePanel.title = @"Document Migration";
>> savePanel.directoryURL = url;
>> savePanel.nameFieldStringValue = [url lastPathComponent];
>> savePanel.allowedFileTypes = [NSArray arrayWithObject:typeName];
>> savePanel.message = @"Your document needs to be upgraded.";
>>
>> [savePanel setCanSelectHiddenExtension:YES];
>> [savePanel setExtensionHidden:YES];
>>
>> NSInteger result = [savePanel runModal];
I've had no problems at all with NSSavePanel under the sandbox (the inherited methods limitation that Graham mentioned excepted).
My usage looks almost exactly like the code above except that I call -beginSheetModalForWindow:completionHandler: instead of -runModal.
BUT. You need the com.apple.security.files.user-selected.read-write entitlement set to YES.
HTH,
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
Weblog: http://www.brockerhoff.net/blog
_______________________________________________
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