0

I've implemented a NSPopover in my Mac app. It works great in 10.7 Lion, but crashes when launching in 10.6 Snow Leopard. I know that support for NSPopover were introduced in Lion and isn't supported in 10.6, but I would like to know how to make my app compatible with the good old' Snow Leopard.

I'm pretty new to Mac development, but here is the code. Any tips? (The popover is located in MainWindow.xib)

.h

NSPopover *popOver;
@property (assign) IBOutlet NSPopover *popOver;
- (IBAction)showPopover:(id)sender;

.m

- (IBAction)showPopover:(id)sender
{    

if (popOver.isShown) {

    [self.popOver close];
}

[[self popOver] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMaxYEdge];    
}
  • You'll have to use something other than NSPopover when the app runs on Snow Leopard, an NSMenu for instance, or make your own popover class. – Vervious Apr 12 '12 at 21:58
  • Thanks. I've decided to use NSDrawer for previous operating systems. Any idea how I can determaine if the user runs 10.6 or 10.7? – user1330190 Apr 16 '12 at 12:36
  • Just check for the existence of the NSPopover class. – Amy Worrall Apr 25 '12 at 09:52
  • It is so funny! I use Mac OS for several years, but the incompatibility between the latest OSs is awesome! Now what can I tell to the MS Windows users when they run their apps in almost any version without issues ?! – Vassilis Aug 12 '13 at 14:09

2 Answers2

2

use MAAttachwindow in your program and try

raees
  • 36
  • 2
0

Check for MAC OS version (link) and if it's 10.6 use NSDrawer, else use NSPopover.

Community
  • 1
  • 1
hockeyman
  • 1,141
  • 6
  • 27
  • 57