本文介绍了applicationWillTerminate不被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在终止之前保存数据,所以我的AppControll类符合NSApplicationDelegate协议,并声明了该方法;在接口构建器中,我将窗口的委托出口绑定到AppController,但无法调用该方法.

I want to save my data before terminating, so my AppControll class conforms the NSApplicationDelegate protocol, and declared the method; and in the interface builder I bound the window's delegate outlet to AppController, but I cannot get the method invoked.

如果我错了,该怎么办?

Where I am wrong, what should I do?

推荐答案

您还记得将处理程序添加到应用程序吗?

Did you remember to add the handler to the application?

UIApplication *app = [UIApplication sharedApplication];
[[NSNotificationCenter defaultCenter]
   addObserver:self
   selector:@selector(applicationWillTerminate:)
   name:UIApplicationWillTerminateNotification object:app];

这篇关于applicationWillTerminate不被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 07:53