remove dispatch_once. It should be safe to call this multiple times.
Although in the default use case this makes pretty much no sense,
but for the demo app it's nice to have.
This commit is contained in:
Stephan Diederich 2013-10-17 18:55:02 +02:00
parent 42e0882eb8
commit 72c8033119

View File

@ -89,21 +89,17 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
[self performSelector:@selector(authenticateInstallation) withObject:nil afterDelay:0.1];
}
static dispatch_once_t authenticatePredicate;
dispatch_once(&authenticatePredicate, ^{
switch ([[UIApplication sharedApplication] applicationState]) {
case UIApplicationStateActive:
[self authenticate];
break;
case UIApplicationStateBackground:
case UIApplicationStateInactive:
// do nothing, wait for active state
break;
}
[self registerObservers];
});
switch ([[UIApplication sharedApplication] applicationState]) {
case UIApplicationStateActive:
[self authenticate];
break;
case UIApplicationStateBackground:
case UIApplicationStateInactive:
// do nothing, wait for active state
break;
}
[self registerObservers];
}
- (void) authenticate {