So I have a window that now works fine as a modal window, but because I don’t like where it appears on the screen, I’m attempting to run it as a sheet instead. My Cocoa books and the NSWindow documentation seem to suggest that any window can be run as a sheet, and they along with XCode’s code-completion suggestions guided me to create this code:
-(IBAction)exportToOpenXml:(id)sender { if ( self.openXmlExportSettings == nil ) { self.openXmlExportSettings = [[OpenXmlExportSettings alloc] init]; } OpenXmlExportSettings* settings = self.openXmlExportSettings; NSWindow* window = [self documentWindow]; [NSApp beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) { // Get this sheet offscreen to prepare for upcoming savePanel sheet [NSApp orderOut:settings]; if ( returnCode == NSModalResponseOK ) { // Rather than reading out the individual settings here, // I’ll just pass along the whole dialog to the next stage, // which is in another function in order to avoid // such extreme indentation [self exportToOpenXmlWithSettings:settings]; } }]; } Now, I’m not sure the returnCode will be what I expect—I’ll follow through with the debugger if I can ever get the sheet to display—but that’s not the problem. The problem is that the attempt to display the sheet causes a crash: 2015-02-09 21:39:40.378 MyApp[5572:1677308] An uncaught exception was raised 2015-02-09 21:39:40.378 MyApp[5572:1677308] -[NSApplication beginSheetModalForWindow:completionHandler:]: unrecognized selector sent to instance 0x6000001001b0 Looks to me like beginSheetModalForWindow:completionHandler: is the modern API, so why would it be unrecognized? Is there a better way I should be doing this? — Charles _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com