Reputation: 65
I created an Application with a Menu-Structure and want to have a DownloadViewController before initializing the first ViewController.
Therefor i coded in DownloadViewController:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}];
[downloadTask resume];
The FirstViewController is presented and all functionalities are still there. But the Menu-Icon in the UINavigationBar is first showing after a few seconds. Can anyone please help me?
Screenshots: NavigationBar after View appeared: after waiting nearly 20 seconds:
Upvotes: 1
Views: 32
Reputation: 4066
This is not an answer but just a proposal
I write here to format the comment properly, try to change in this:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
dispatch_async(dispatch_get_main_queue()) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}
}];
[downloadTask resume];
Upvotes: 1