我正在构建一个登录模块,用户输入的凭据在后端系统中进行验证。我正在使用异步调用来验证凭据,并且在用户通过身份验证后,我使用方法presentViewController:animated:completion
继续下一个屏幕。问题是presentViewController
方法启动需要花费一些时间,直到出现下一个屏幕。恐怕我之前拨打sendAsynchronousRequest:request queue:queue completionHandler:
的电话会以某种方式造成副作用。UIViewController presentViewController:动画:完成 - 需要4到6秒才能启动
只是为了确保当我说4 - 6秒是命令presentViewController:animated:completion
开始后。我说这是因为我正在调试代码并监视调用方法的时刻。
第一:NSURLConnection
方法被称为:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
二:UIViewController
方法被调用采取异常运行时间
UIViewController *firstViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"FirstView"];
[self presentViewController:firstViewController animated:YES completion:nil];
任何帮助表示赞赏。
谢谢, 马科斯。
那么你是否从完成块中调用表示代码? – 2013-02-26 00:34:27
是的,我正在从完成块打电话给它 – vilelam 2013-02-26 00:35:52