开发者

NSApplicationWillTerminateNotification not Working

开发者 https://www.devze.com 2023-03-28 13:36 出处:网络
My problem is that the NSApplicationWillTerminateNotification is not called when I quit my applicat开发者_运维技巧ion. What I have tried: (appDelegate.m)

My problem is that the NSApplicationWillTerminateNotification is not called when I quit my applicat开发者_运维技巧ion. What I have tried: (appDelegate.m)

- (void) applicationDidFinishLaunching:(NSNotification *)aNotification{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
}

- (void)applicationWillTerminate:(NSNotification *)aNotification{
NSLog(@"quit");
}

OR

- (void)applicationWillTerminate:(NSApplication *)application{
NSLog(@"Quit");
}

My application has no window, as it is a background application -> I deleted the window and the menu in interface Builder.


Apps in the background are terminated without any notification.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号