-[NSWindow makeFirstResponder:] error when NSDrawer is involved
-[NSWindow makeFirstResponder:] error when NSDrawer is involved
- Subject: -[NSWindow makeFirstResponder:] error when NSDrawer is involved
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 24 Mar 2017 14:04:30 -0400
The principal view in my application's main window is a browser view. I want to make the browser view the main window's first responder.
My application also has a drawer associated with the main window. The first time -[NSWindow makeFirstResponder:] is called on the main window to make its browser view the first responder, I get this error message: "Setting <NSBrowser...> as the first responder for window <NSDrawerWindow...>, but it is in a different window.... This would eventually crash when the view is freed. The first responder will be set to nil." All subsequent calls to -makeFirstResponder: work correctly.
The error message is wrong when it says I am trying to set NSBrowser as the first responder for the drawer's hidden parent window. I have verified a dozen different ways that I am correctly calling -makeFirstResponder: on the main window -- by logging the main window's memory address and comparing it with the actual main window address, for example.
The error appears no matter where or how I call -makeFirstResponder. I have tried calling it in various places in my code, and by connecting the initialFirstResponder outlet to the main window in the nib file instead of calling -makeFirstResponder, and even by calling [[browser window] makeFirstResponder:].
The error appears no matter which view in the main window I try to make its first responder, such as a pop-up menu button. In other words, it isn't the choice of an NSBrowser as first responder that is causing the problem.
This error message first started appearing in macOS Sierra 10.12.0, and it is still appearing in 10.12.3. I suspect it is a bug in Sierra. When I examine the object code, I see that -makeFirstResponder: does in fact include some commands relating to drawers. I don't know why it does, but I suppose it might be making some inappropriate assumptions about my intent.
Fortunately, the error does not affect my application's functionality, presumably because setting the first responder of the drawer window to nil is not a problem. But I would like to get to the bottom of this.
Has anybody else encountered this issue? Any suggestions?
--
Bill Cheeseman - email@hidden
_______________________________________________
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