I\'m trying to display MFMailComposeViewController
in an app.
if MFMailComposeViewController.canSendMail() {
let mailComposeViewController
The reason why the Mail composer dismisses immediately is because you can't actually send an email from the simulator. The implementation is different from iOS itself.
What I guess is happening here is that while the simulator implementation uses just some normal UI elements, the MFMailComposeViewController
on native iOS is actually hosted like UIDocumentPickerViewController
or UIActivityViewController
. This means screenshots and trying to traverse the view tree is impossible, because the view is not an actual part of your application. They do that because these controllers contain user private information. Hosted view controller do NOT allow for customization, and do not comply with your global UINavigationBar.appearance()
. This would explain why it does show up in the simulator and not on your native device.