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 秒后,模态视图最终被关闭。
什么可能导致这种延迟?