MFMailComposeViewController behaves differently in iOS 13 simulator and device

后端 未结 3 1803
执笔经年
执笔经年 2020-12-18 18:51

I\'m trying to display MFMailComposeViewController in an app.

if MFMailComposeViewController.canSendMail() {
    let mailComposeViewController          


        
相关标签:
3条回答
  • 2020-12-18 19:22

    This is new UI Style from iOS 13. You can disable it in Storyboard or set manual. Presenting modal in iOS 13 fullscreen

    0 讨论(0)
  • 2020-12-18 19:42

    Add this line of code before present it. It will work normal. This a change in iOS 13

    mailController.modalPresentationStyle = .fullScreen
    
    0 讨论(0)
  • 2020-12-18 19:46

    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.

    0 讨论(0)
提交回复
热议问题