Presenting view controllers on detached view controllers警告

开发中遇到Presenting view controllers on detached view controllers的警告,虽然不会引起崩溃,但是肯定是不符合正常的页面层级规范,查找了下原因,是因为调用presentViewController时,原ViewController并没有在当前app的视图堆栈里,被判定为所谓的分离视图detach view controller,如果在这上面presentViewController就会收到警告。解决方法:找到视图堆栈的最上层ViewController,在这上面presentViewController就可以了。

你可能感兴趣的:(Presenting view controllers on detached view controllers警告)