I'm trying to add title bar accessory view in app. For one of the beta testers i'm getting exception:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'titlebarViewController not supported for this window style'
Exception happens in this line:
[window addTitlebarAccessoryViewController:vc];
Any ideas what's causing it, can i somehow check for crash condition in code and disable adding title bar accessory view if that condition occurs ?
Turns out the exception happens when the window does not show title bar (NSTitledWindowMask == 0). So check for this can be done as follow:
NSWindow *window = self.view.window;
if ((window.styleMask & NSTitledWindowMask) == 0){
// Ignore if no title bar on window
return;
}
But there was another issue in our code. When app was launch in full screen mode self.view.window was returning different window - NSToolbarFullScreenWindow as the view was part of the other title bar accessory view (toolbar) and in fullscreen it had different window parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With