What is the best way to implement backwards compatibility, when building an app for Mac OS X 10.7 but also staying compatible for 10.6?
I have an application that uses an NSPopover when the client is 10.7 and an NSMenu when the client is 10.6. The problem is, that when starting the app on a 10.6 machine, the app crashes with a "symbol not found" exception, saying that (kind of) "_OBJC$_NSPopover could not be found in AppKit". Do i have to use id throughout the application for the new features?
You can get the class object for NSPopover by using the function NSClassFromString() this return a Class object with you can use to create instances for example
id thePopover = [[NSClassFromString(@"NSPopover") alloc] init];
another possibility is to have two separate nib files one for 10.6 and one for 10.7, the nib does not have to be the complete interface, just the part that contains the NSPopover and then load the appropriate nib file at run time.
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