MFMailComposeViewController behaves differently in iOS 13 simulator and device

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

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

if MFMailComposeViewController.canSendMail() {
    let mailComposeViewController          


        
3条回答
  •  隐瞒了意图╮
    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.

提交回复
热议问题