Wednesday, 21 August 2013

NSOpenPanel reopening after selection

NSOpenPanel reopening after selection

Some users are reporting that they cannot select files in my sandboxed app
because when they select and item it reopens.
Nowhere in my code am I reopening the panel so I'm a bit confused as to
why this would be happening.
One of my users said that the following message was logged in console a
number of times:
"Keychain sandbox consume extension error: s=-1 p= cannot allocate memory"
I've asked them to run first aid on their keychain, and repair their disk
permissions but that hasn't helped.
Does anyone have any ideas what could be causing this?
Thank you!
Here is the code that triggers the NSOpenPanel:
- (IBAction)selectHomeDirectory:(id)sender {
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setTitle:@"Select your home folder"];
[openPanel setMessage:[NSString stringWithFormat:@"Select your home
folder..."]];
[openPanel setPrompt:@"Choose"];
[openPanel setCanCreateDirectories:NO];
[openPanel setCanChooseFiles:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setExtensionHidden:YES];
[openPanel setAllowedFileTypes:nil];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setDelegate:self];
[openPanel setDirectoryURL:[NSURL fileURLWithPath:@"/Users/"]];
[openPanel beginSheetModalForWindow:self.window
completionHandler:^(NSInteger result) {
if(result != NSOKButton || !openPanel.URL){
return;
}
/* Saves the scoped URL, and then triggers a view change */
}];
}

No comments:

Post a Comment