블럭으로 쌓인 코드가 실행 될 때 딜레이(?)가 발생하는 현상이 있는데

잘은 모르겠지만 큐에 들어갔다가 실행되어서 느리게 동작하는 것처럼 보이는듯 하다

정확한 이유 아시는분은 좀 알려주세요....

 

 

ACAccountStore * accountStore = [[ACAccountStore alloc] init];

ACAccountType * accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

//기존

[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError * error){ 

........

....... 한박자 느리게 동작한다

}];

 

//수정

[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError * error){ 

dispatch_async(dispatch_get_main_queue(), ^{

     ........

....... 즉시 동작한다

});}];

Posted by 떡공이
,