Unbalanced calls to begin/end appearance transitions for

前端 未结 25 1104
陌清茗
陌清茗 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: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)
    }
    

提交回复
热议问题