在iOS应用程序上使用unity发送电子邮件时出错

时间:2016-03-18 14:50:23

标签: c# c++ ios email unity3d

我正在研究一个学校项目,我正在尝试记录从我统一制作的游戏中存储的数据。

我的问题是我想通过电子邮件发送数据真实应用。一切正常,电子邮件正在发送数据等。但是当我将应用程序构建到iOS设备时,它不会发送电子邮件。

我在团结中没有任何错误,但是当我构建应用程序时,我在Xcode中遇到此错误。请参阅下面的错误。我希望有人可以帮助我。

问候,

Georgi Iliev

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)

1 个答案:

答案 0 :(得分:4)

这是 IL2CPP 中的bug。 Unity没有任何计划很快解决这个问题,因为有一个临时的解决方案可以解决它。

link.xml 中,添加以下内容。

carousel-indicators

它基本上告诉Xcode不要删除这些邮件。

如果您没有 link.xml ,请创建它并将上面的代码放入其中,然后将该文件放在Asset文件夹中。重建项目。

修改

根据下面的comment,现在还需要添加以下行:

<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>