Normally an application bundle on OS X can only be started once, however by simply copying the bundle the same application can be launched twice. What\'s the best strategy t
detect if application with same bundleID is running, activate it and close what starts.
- (id)init method of < NSApplicationDelegate >
NSArray *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]];
if ([apps count] > 1)
{
NSRunningApplication *curApp = [NSRunningApplication currentApplication];
for (NSRunningApplication *app in apps)
{
if(app != curApp)
{
[app activateWithOptions:NSApplicationActivateAllWindows|NSApplicationActivateIgnoringOtherApps];
break;
}
}
[NSApp terminate:nil];
return nil;
}