本文介绍了applicationWillTerminate不被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我实现了applicationWillTerminate方法,但从未调用过
I implemented applicationWillTerminate method, but it's never called
-(void)applicationWillTerminate:(NSNotification *)notification
{
[[NSApplication sharedApplication] terminate:self];
NSLog(@"EOP");
}
如何在应用程序关闭之前执行一些代码?
How to execute some code before application close?
谢谢
推荐答案
我刚刚添加
-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) sender{
return YES;
}
现在applicationWillTerminate调用
Now applicationWillTerminate invokes
这篇关于applicationWillTerminate不被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!