don't register twice

This commit is contained in:
Stephan Diederich 2013-09-10 17:06:00 +02:00
parent ebbe6dc0af
commit e3dcfa629f

View File

@ -462,14 +462,16 @@ static NSString* const kBITAuthenticatorLastAuthenticatedVersionKey = @"BITAuthe
} }
- (void) registerObservers { - (void) registerObservers {
__weak typeof(self) weakSelf = self; if(nil == _appDidBecomeActiveObserver) {
_appDidBecomeActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification __weak typeof(self) weakSelf = self;
object:nil _appDidBecomeActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
queue:NSOperationQueue.mainQueue object:nil
usingBlock:^(NSNotification *note) { queue:NSOperationQueue.mainQueue
typeof(self) strongSelf = weakSelf; usingBlock:^(NSNotification *note) {
[strongSelf applicationDidBecomeActive:note]; typeof(self) strongSelf = weakSelf;
}]; [strongSelf applicationDidBecomeActive:note];
}];
}
} }
- (void) unregisterObservers { - (void) unregisterObservers {