Pushing an MFMailComposeViewController onto the navigation stack? Not presented modally

人走茶凉 提交于 2019-12-01 19:06:03

This is because MFMailComposeViewController isn't a subclass of UIViewController but of UINavigationController. UINavigationController throws an exception when you're attempting to push a UINavigationController or subclass of UINavigationController onto an existing stack. Presenting a UINavigationController modally is permitted.

According to Apple documentation

To display the view managed by this view controller, you can use any of the standard techniques for displaying view controllers

So what you are trying to do is supposed to work in both cases. Did you have a look at the logs ?

I would have bet your navigationController is nil, because this typically happens when you are using a plain UIViewController (not embedded in a UINavigationController, but it you actually present your modal view onto the navigationController, it may not be nil.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!