Znaczny czas na naciśnięcie UIViewController w bloku zakończenia Twittera
Podczas uruchamiania tego kodu ...
-(IBAction)loginWithTwitter:(id)sender {
NSLog(@"Logging in with twitter");
ACAccountStore *accountStore = [[ACAccountStore alloc]init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) {
if (error) {
[self showError:error];
return;
}
if (granted) {
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
if ([accountsArray count] > 1) {
NSLog(@"Multiple twitter accounts");
}
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSLog(@"%@", twitterAccount);
[self pushMainController];
}
}];
}
Istnieje opóźnienie 5-10 sekund przedpushMainController
jest rzeczywiście wywoływany, nawet jeśli informacje o koncie są rejestrowane niemal natychmiast (po wstępnej autoryzacji). Jeśli przeniosępushMainController
zadzwoń po bloku, jednak dzieje się to natychmiast, jedyny problem polega na tym, że użytkownik nie musi być zalogowany w tym momencie. Rozumiem, że może upłynąć sekunda, zanim blok otrzyma odpowiedź ze względu na zmienne, takie jak połączenie sieciowe, ale czy ktoś może mi pomóc to zrozumieć?