Warning: Attempt to present on whose view is not in the window hierarchy !, Attempthierarchy

Source: Internet
Author: User

Warning: Attempt to present on whose view is not in the window hierarchy !, Attempthierarchy

When I want to jump from one VC to another

-(Void) presentViewController :( UIViewController *) viewControllerToPresent animated: (BOOL) flag completion :( void (^) (void) completion; you can also use navigation push.

Sometimes this type of Warning occurs: Warning: Attempt to present on whose view is not in the window hierarchy!

Cause: page Jump can only be performed after viewDidLoad and viewDidAppear.

Solution: Make sure that the page Jump is performed after the view load is complete.

First: Wait for the execution of view Load to end with a delay, but this method is time-consuming.

Method 2: Used in viewDidLoad

[Self?mselec=mainthread: @ selector (login) withObject: nilwaitUntilDone: NO];

Write the code for page Jump into the function, and then set waitUntilDone to NO

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.