Something weird is happening with an NSOpenPanel. Here's the code:
(This is inside a simple class which has access to an NSPersistentDocument via the document property).
When this runs the open panel appears, the selected file is processed and everything seems normal. "Processing" a file in this instance adds objects to the managed object context. But... once this code has run the Quit menu option and various others are disabled - as if the panel is still in place, and I have to force quit. I'm using an NSSavePanel in the same way without the same issue.
I haven't used Blocks very much in this manner - am I doing something wrong?
Code:
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setAllowedFileTypes:[NSArray arrayWithObject:@"categories"]];
[openPanel beginSheetModalForWindow:[self.document windowForSheet] completionHandler:^(NSInteger result){
if (result==NSFileHandlingPanelOKButton) {
// Process the file
}
}];
(This is inside a simple class which has access to an NSPersistentDocument via the document property).
When this runs the open panel appears, the selected file is processed and everything seems normal. "Processing" a file in this instance adds objects to the managed object context. But... once this code has run the Quit menu option and various others are disabled - as if the panel is still in place, and I have to force quit. I'm using an NSSavePanel in the same way without the same issue.
I haven't used Blocks very much in this manner - am I doing something wrong?