0

Is it possible to create one binary and, according to the OS X version, have it behave differently?

Any ideas (Cocoa- and Xcode- friendly) on how this could be achieved?

0

2 Answers 2

2

The main executable for your application can be a small program which runs on all versions, interrogates the OSX version and then either loads a bundle which contains the version of the application desired or starts a second executable which is bundled into the application package.

The bundle loading option should be easier to do and look slicker from as user perspective as only a single application would be running. Using the other approach one application would start and then close while starting another so it's likely to have a visual side effect.

Sign up to request clarification or add additional context in comments.

Comments

1

Wain got that right.. use one app and have it load bundles based on the OS version

something like

int main(args) { NSBundle *bundle = nil; if(osVersion < 10.5) bundle = [NSBundle bundleWithURL:pathToBundleFor105InAppsBundle]; else bundle = [NSBundle bundleWithURL:pathToBundleFor106andUpInAppsBundle]; [bundle load]; Class appDelegateClass = NSClassFromString(@"AppDelegateClass"); DDAppDelegate = [[appDelegateClass alloc] init]; [[NSApplication sharedApplication] setDelegate:DDAppDelegate]; status = NSApplicationMain(argc, (const char **)argv); } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.