使用 Unity 在 iOS 应用程序上发送电子邮件时出错
Error while sending email on iOS app with unity
我正在做一个学校项目,我正在尝试记录从我在 Unity 中制作的游戏中存储的数据。
我的问题是我想通过电子邮件将数据真实地发送到应用程序。 一切正常,电子邮件与数据一起发送等。但是当我将应用程序构建到 iOS 设备时,它不会发送电子邮件。
我在 Unity 中没有任何错误,但是当我构建应用程序时,我在 Xcode 中收到此错误。请参阅下面的错误。我希望有人能帮助我。
问候
格奥尔基·伊利耶夫
MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Net.Configuration.MailSettingsSectionGroup'.
at Mono.Security.Authenticode.AuthenticodeBase.GetSecurityEntry () [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionGroupInstance (System.Configuration.SectionGroupInfo group) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionGroupCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Net.Mail.SmtpClient..ctor (System.String host, Int32 port) [0x00000] in <filename unknown>:0
at MonoGmail.Start () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
添加了@programmers解决方案并得到了一个新的混合错误。
MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Net.Configuration.MailSettingsSectionGroup'.
at StartMenu.CloseApp () [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in <filename unknown>:0
at System.Collections.Generic.Comparer`1[T].get_Default () [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionGroupInstance (System.Configuration.SectionGroupInfo group) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionGroupCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.MonoTODOAttribute..ctor () [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Net.Mail.SmtpClient..ctor (System.String host, Int32 port) [0x00000] in <filename unknown>:0
at System.Net.Mail.SmtpClient..ctor (System.String host) [0x00000] in <filename unknown>:0
at Mono_Gmail.Start () [0x00000] in <filename unknown>:0
at System.Array.GetGenericValueImpl[T] (Int32 pos, .T& value) [0x00000] in <filename unknown>:0
at System.Array.GetGenericValueImpl[T] (Int32 pos, .T& value) [0x00000] in <filename unknown>:0
at System.Array.GetGenericValueImpl[T] (Int32 pos, .T& value) [0x00000] in <filename unknown>:0
at System.Array.GetGenericValueImpl[T] (Int32 pos, .T& value) [0x00000] in <filename unknown>:0
System.Array:GetGenericValueImpl(Int32, T&)
System.Array:GetGenericValueImpl(Int32, T&)
System.Array:GetGenericValueImpl(Int32, T&)
System.Array:GetGenericValueImpl(Int32, T&)
(Filename: currently not available on il2cpp Line: -1)
这是 IL2CPP 中的一个错误。 Unity 没有任何计划在短期内解决此问题,因为有一个临时解决方案可以修复它。
在您的链接.xml中,向其添加以下内容。
<linker>
<assembly fullname="System">
<type fullname="System.Net.Configuration.MailSettingsSectionGroup" preserve="all"/>
<type fullname="System.Net.Configuration.SmtpSection" preserve="all"/>
<type fullname="System.Net.Configuration.SmtpNetworkElement" preserve="all"/>
</assembly>
</linker>
它基本上是告诉Xcode不要剥离这些邮件内容。
如果您没有 link.xml,请创建它并将上面的代码放入其中,然后将文件放在 Asset 文件夹中。重新生成项目。
编辑:
根据下面的评论,现在还需要添加以下行:
<type fullname="System.Net.Configuration.SmtpSpecifiedPickupDirectoryElement" preserve="all"/>
相关文章:
- 尝试从C++访问 UWP 的电子邮件邮件类会导致"REGDB_E_CLASSNOTREG类未注册"错误
- 如何使HTML5电子邮件验证正则表达式在C++中工作?
- Qt:使用'mailto:'打开用户的电子邮件客户端失败
- 电子邮件地址中的c++smtp服务器主机名
- 如何使用 c++ (curl) 发送电子邮件
- 在端口 587 (TLS) 上使用 CDO 发送电子邮件时出错
- 预览由Microsoft Outlook 对象库生成的电子邮件
- 如果不有效,如何重复用户输入电子邮件
- 使用REGEX进行电子邮件输入验证C
- 如何从 pjsip 发送电子邮件.是否有任何可用于发送电子邮件的默认方法
- 如何在使用 c++/COM 发送时在电子邮件中插入/嵌入图像文件(.png)
- 使用Regex验证电子邮件和电话字段QT
- 带有 TLS v. 1.2 和 SSL v.3 电子邮件客户端的 Boost.Asio 上下文:ssl3 警报意外消息
- 如何发送带有嵌入图片的电子邮件
- 如何提示用户在C++中输入正确的电子邮件地址格式
- 我在尝试使用 libquickmail 发送电子邮件时收到错误
- C 从电子邮件向量中删除
- 使用VC 应用中的VSTO ADDIN触发Outlook电子邮件附件的删除
- 尝试安装Qxt以发送电子邮件时出错
- 使用 Unity 在 iOS 应用程序上发送电子邮件时出错