Xamarin - iOS MFMailComposeViewController.CanSendMail 导致“在执行本机代码时得到 segv”

问题描述

我正在尝试使用带有 DependencyInjection 的 iOS 代码从 Xamarin Forms 应用程序发送电子邮件,如下所示:

[assembly: Xamarin.Forms.Dependency(typeof(SendMail))]
namespace SampleApp.iOS.PlatformSpecific
{
  public class SendMail : ISendMail
  {
    public void SendMail()
    {
       Device.BeginInvokeOnMainThread(() =>
       {
         if (MFMailComposeViewController.CanSendMail)  <-- crashes here
         {
            // my code
         }
       }
     }
  }
}

上面指示的行在真实设备上总是崩溃(但在模拟器上有效)。崩溃如下:

=================================================================
    Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a Fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

有什么想法可能出问题了吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)