Unbalanced calls to begin/end appearance transitions for

前端 未结 25 1096
陌清茗
陌清茗 2020-12-02 06:31

I have this problem when I simulate my app, its not an error or a warning but it appears in my console, has anyone ever experienced this before?

相关标签:
25条回答
  • 2020-12-02 07:09

    I had this problem when I forget to set Break; after pushing the view in a switch statement!

    Like here:

    case 1:{
    
            SomeViewController *someViewController = [[SomeViewController alloc]initWithNibName:@"SomeViewController" bundle:Nil];
            [self.navigationController pushViewController:someViewController animated:YES];
            [someViewController release];
        }
    
            break; //Forgetting to set break here:
    
    0 讨论(0)
  • 2020-12-02 07:11

    You should run your code in different loop to avoid this

     double delayInSeconds = 0.1;
            dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
            dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
                // Put your code here
    [self presentViewController:self.yourModalVC animated:YES completion:nil];
            });
    
    0 讨论(0)
  • 2020-12-02 07:11

    I had some logic implemented to wait pushing the UIViewController until all data was downloaded. There was an error in this logic which caused to push the UIViewController too early while there was still another API call in progress.

    It caused the same UIViewController to be pushed twice by the UINavigationController and gave this warning.

    0 讨论(0)
  • 2020-12-02 07:12

    I had lot of problem with the same issue. I solved this by this way

    1) You're not using UIViewController's designated initializer initWithNibName:bundle:. Try using it instead of just init.

    2) set animated:YES to a NO, and that solved the problem. eg. [self.navigationController pushViewController: viewController_Obj animated:NO];

    0 讨论(0)
  • 2020-12-02 07:13

    Swift 4

    My issue was that I was presenting another VC before my current one finished to be rendered .

    Solution was to present my nextVC after a quick delay.

    WHAT YOU SHOULD NOT DO

    override func viewDidLoad() {
        super.viewDidLoad() 
        self.present(MyNextVC(), animated: true, completion: nil)
    }
    

    WHAT YOU SHOULD DO

    override func viewDidLoad() {
        super.viewDidLoad() 
        //Wait until the view finished to be constructed
        perform(#selector(showMyNextVC), with: nil, afterDelay: 0.01)
    }
    
    @objc func showCityList() {
        self.present(MyNextVC(), animated: true, completion: nil)
    }
    
    0 讨论(0)
  • 2020-12-02 07:14

    i have same problem when i used navigationcontroller's pop method In my app i use a separate logic for navigation controller,So avoided the use of navigation bar and it is always hidden. Then i use a custom view and notification for handling the backbutton and it's events. notification observers are registered and and not removed. So the notification fires twice, and it creates the above mentioned error. Check your code throughly for getting such fault's

    0 讨论(0)
提交回复
热议问题