Ios NSNotification在将控制器显示为presentViewController后停止工作

Ios NSNotification在将控制器显示为presentViewController后停止工作,ios,uiviewcontroller,nsnotifications,Ios,Uiviewcontroller,Nsnotifications,我向UIViewController添加了捕获通知 - (void)applicationWillResignActive:(UIApplication *)application: 像这样 - (void)viewDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:)

我向UIViewController添加了捕获通知

  - (void)applicationWillResignActive:(UIApplication *)application:
像这样

  - (void)viewDidLoad {

           [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:)
                                                 name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];
它工作正常,但如果我显示其他控制器如下:

[self presentViewController:[[UINavigationController alloc] initWithRootViewController:view]
                   animated:YES
                 completion:nil];
通知停止工作。 我仅在中删除通知

 - (void)viewDidUnload {

     [super viewDidUnload];

     [[NSNotificationCenter defaultCenter] removeObserver:self name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];

但是当我显示模态控制器时,它没有被调用。

对不起,我在基类中找到了一个删除通知的位置。

对不起,我在基类中找到了一个删除通知的位置。

我遇到了同样的问题:基类删除了所有通知。。。谢谢分享你的发现-它节省了我很多时间!非常感谢。做了同样的事情。我有同样的问题:基类删除了所有通知。。。谢谢分享你的发现-它节省了我很多时间!非常感谢。做了同样的事。