我的应用程序中dismissViewControllerAnimated:completion:工作正常,除了消失之间的延迟。
[api loginWithUsername:[dict objectForKey:@"username"] andPassword:[dict objectForKey:@"password"] andSuccessBlock:^(id json) {
NSLog(@"DONE... %@", [json objectForKey:@"status"]);
NSString *status = [json objectForKey:@"status"];
if([status isEqualToString:@"ok"]){
app.user = [json objectForKey:@"data"];
[self dismissViewControllerAnimated:YES completion:nil];
}else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"could not log you in" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
}
}];
在我的控制台中,我可以看到打印出了“DONE... ok”,这意味着回调块已经执行,但大约3-4秒后模态视图才最终被关闭。
是什么原因导致了这种延迟?