그래서 ACAccountStore를 사용하여 로그인/가입하려고합니다. 이것은 모달로 제공되는보기 컨트롤러를 사용하여 발생합니다. 그런 식으로 잘 작동하지만 뷰 컨트롤러를 닫을 때 기본/제시 컨트롤러는 여전히 검정색 창입니다. 완성 블록이 끝나기를 기다리지 않기 때문에 이런 일이 일어난다 고 가정합니다.XCode - 블록 완료시 코드 실행
내 질문 : [self dismissViewControllerAnimated:YES completion:nil];
에 전화하기 전에 완료 블록이 완료 될 때까지 어떻게 기다려야합니까?
-(void)loginWithTwitter{
ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:
ACAccountTypeIdentifierTwitter];
[account requestAccessToAccountsWithType:accountType options:nil
completion:^(BOOL granted, NSError *error)
{
if (granted) {
//do something -> call function to handle the data and dismiss the modal controller.
}
else{
//fail and put our error message.
}
}];
}
왜 다른 코드 뒤에 삽입 할 수 없습니까? 딜레이가 필요하다면 딜레이 후에 공연 선택기를 사용하지 않는 것이 좋습니다. 그것은 예쁘지 않지만 C'est la vie. –