我正在構建一個登錄模塊,用戶輸入的憑據在後端系統中進行驗證。我正在使用異步調用來驗證憑據,並且在用戶通過身份驗證後,我使用方法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