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。,意味着回调block执行正常,但是接下来需要三四秒钟延迟视图才能最终被dismiss。
怎么解决这个延迟问题?谢谢