Hi folks,
I have following example of code:
What I wanted to achieve with it is to get notification when the "AnApp" has been launched.
I do get the notification only when the "AnApp" application is not active and I call "launchApplication".
When the "AnApp is already up and running and my application do try to launch it again the method still returns true but I do not get any notification back.
Is there any thing that I do wrong ?
Do I call the launchApplication too early ?
Any help will be appreciated.
b.r.
Petron
I have following example of code:
Code:
- (void)appHasLaunched:(NSNotification *)notif {
NSLog(@"Notification arrived");
}
- (id)init {
self = [super init];
if (self) {
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSNotificationCenter *notifyCenter = [ws notificationCenter];
[notifyCenter addObserver:self
selector:@(appHasLaunched:)
name:NSWorkspaceDidLaunchApplicationNotification
object:nil];
if ([ws launchApplication:@"AnApp.app"]) {
NSLog(@"Launch Returened True");
} else {
NSLog(@"Launch Returned False");
}
}
What I wanted to achieve with it is to get notification when the "AnApp" has been launched.
I do get the notification only when the "AnApp" application is not active and I call "launchApplication".
When the "AnApp is already up and running and my application do try to launch it again the method still returns true but I do not get any notification back.
Is there any thing that I do wrong ?
Do I call the launchApplication too early ?
Any help will be appreciated.
b.r.
Petron