Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

后端 未结 30 3068
一整个雨季
一整个雨季 2020-11-21 23:39

Just started using Xcode 4.5 and I got this error in the console:

Warning: Attempt to present < finishViewController: 0x1e56e0a0 > on < ViewCont

30条回答
  •  盖世英雄少女心
    2020-11-21 23:52

    In case it helps anyone, my issue was extremely silly. Totally my fault of course. A notification was triggering a method that was calling the modal. But I wasn't removing the notification correctly, so at some point, I would have more than one notification, so the modal would get called multiple times. Of course, after you call the modal once, the viewcontroller that calls it it's not longer in the view hierarchy, that's why we see this issue. My situation caused a bunch of other issue too, as you would expect.

    So to summarize, whatever you're doing make sure the modal is not being called more than once.

提交回复
热议问题