MFMailComposeViewController在iOS 13模拟器和设备中的行为有所不同

编程入门 行业动态 更新时间:2024-10-25 22:26:47
本文介绍了MFMailComposeViewController在iOS 13模拟器和设备中的行为有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在应用程序中显示MFMailComposeViewController.

I'm trying to display MFMailComposeViewController in an app.

if MFMailComposeViewController.canSendMail() { let mailComposeViewController = MFMailComposeViewController() mailComposeViewController.navigationBar.tintColor = .white mailComposeViewController.mailComposeDelegate = self mailComposeViewController.setToRecipients(["support@gmail"]) mailComposeViewController.setSubject("Feedback") present(mailComposeViewController, animated: true) } else { print("This device is not configured to send email. Please set up an email account.") }

在iOS 12中,它显示没有问题.在模拟器和设备中.

In iOS 12, it shows up without an issue. In both simulator and device.

但是当我在运行iOS 13的设备上运行同一项目时,看起来像这样.

But when I run the same project on a device running iOS 13, it looks like this.

导航栏颜色消失了.另外,发送按钮也不可见.

The navigation bar color is gone. Also the send button is also invisible.

所以我添加了mailComposeViewController.navigationBar.backgroundColor = .mv_primary,但是它仍然没有显示在设备上.奇怪的是,背景色显示在模拟器中.

So I added mailComposeViewController.navigationBar.backgroundColor = .mv_primary but it still doesn't show on the device. Strangely the background color shows in the simulator.

但是有一种奇怪的行为.当我在模拟器中运行MFMailComposeViewController时,它会立即自动关闭.

However there's a strange behavior. The MFMailComposeViewController immediately dismisses by itself when I run it in the simulator.

Xcode控制台中也会显示以下错误.

The following error also shows up in the Xcode console.

[公共] [FBSSystemService] [0x5f27]处理以下请求的打开请求时出错 com.apple.MailCompositionService:{ userInfo = { FBSOpenApplicationRequestID = 0x5f27; } 底层错误=; } 2019-11-01 14:40:05.214158 + 0530 MailCompose [11289:262267] [声明]连接 请求无效而没有恢复我们的_serviceSessionConnection. 这是一个错误. 2019-11-01 14:40:05.216901 + 0530 MailCompose [11289:262054] [常规] #CompositionServices _serviceViewControllerReady:NSError域= _UIViewServiceInterfaceErrorDomain代码= 0

[Common] [FBSSystemService][0x5f27] Error handling open request for com.apple.MailCompositionService: { userInfo = { FBSOpenApplicationRequestID = 0x5f27; } underlyingError = ; } 2019-11-01 14:40:05.214158+0530 MailCompose[11289:262267] [Assert] Connection request invalidated without resuming our _serviceSessionConnection. This is an error. 2019-11-01 14:40:05.216901+0530 MailCompose[11289:262054] [General] #CompositionServices _serviceViewControllerReady: NSError Domain=_UIViewServiceInterfaceErrorDomain Code=0

我猜奇怪的解雇错误是Xcode错误.但是,如何解决背景色和发送按钮未显示在设备中的问题?

I guess the weird dismiss error is a Xcode bug. But how do I fix the background color and the send button not showing up in the device?

这是我设置所有与导航栏相关的样式的方法.

This is how I set all the navigationbar related styles.

UINavigationBar.appearance().barTintColor = .mv_primary UINavigationBar.appearance().tintColor = .white UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] if #available(iOS 11.0, *) { UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white] }

演示项目

推荐答案

这是iOS 13中的新UI样式.您可以在Storyboard中禁用它或设置手册. 在iOS 13全屏中呈现模式

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

更多推荐

MFMailComposeViewController在iOS 13模拟器和设备中的行为有所不同

本文发布于:2023-11-05 15:51:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561251.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有所不同   模拟器   设备   MFMailComposeViewController   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!