NSNotificationCenter in viewDidLoad: not working
for some reason this c开发者_高级运维ode isn't working in viewDidLoad
, but will work in viewWillAppear
. Any ideas?
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(wakeUp:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
Thank you
you're definitely sure viewDidLoad
is being invoked?
For my case is that I put the removeObserver
method inside didReceiveMemoryWarning
method, and if I take a picture or do something else, this method fires out of my expect. So, now I always remove notification observer at dealloc
stage.
精彩评论