My NSNotification Observer is not just for a certain view or view controller. I want it to be removed only when users close the app. I put the "add observer" in AppDelegate. Do I still need to remove it in deinit manually or it gets removed automatically when the app is closed?
If you want notification for certain view controller then please add add observer
to that particular classes and remove observer
in viewDidDisappear
. Ae seen your case, right now you have added add observer
in app delegate
, then you can remove it in below methods according to your requirements.
- (void)applicationWillResignActive:(UIApplication *)application
- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillTerminate:(UIApplication *)application