Search Unity

Error while sending Email in Unity iOS App

Discussion in 'iOS and tvOS' started by EchtMe, Mar 19, 2018.

  1. EchtMe

    EchtMe

    Joined:
    Jan 16, 2018
    Posts:
    10
    Hi there,

    Please help, I've tried a couple of different options to send an email through the iOS build, but nothing works for me. I can run it in the Unity Editor and the Email works, but not on the mobile app.

    Unity: 2017.3f
    iOS: 11.2.2
    XCode: 9.2
    Unity API Level: .NET 2.0 and I tried .NET 2.0 Subset

    I have added the link.xml into the Assets folder.
    link.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"/>
    <type fullname="System.Net.Configuration.SmtpSpecifiedPickupDirect‌oryElement" preserve="all"/>
    </assembly>
    </linker>

    XCode Error:
    MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Net.Configuration.SmtpSpecifiedPickupDirectoryElement'.

    at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
    at System.Configuration.PropertyInformation.get_Value () [0x00000] in <filename unknown>:0
    at System.Configuration.PropertyInformation.Reset (System.Configuration.PropertyInformation parentProperty) [0x00000] in <filename unknown>:0
    at System.Configuration.ElementInformation.Reset (System.Configuration.ElementInformation parentInfo) [0x00000] in <filename unknown>:0
    at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
    at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
    at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0
    at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [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 EmailController.SendEmail () [0x00000] in <filename unknown>:0
    at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <filename unknown>:0
    at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) [0x00000] in <filename unknown>:0
    at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, Boolean pressed, Boolean released) [0x00000] in <filename unknown>:0
    at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () [0x00000] in <filename unknown>:0
    at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <filename unknown>:0
    UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    UnityEngine.EventSystems.StandaloneInputModule: ProcessTouchPress(PointerEventData, Boolean, Boolean)
    UnityEngine.EventSystems.StandaloneInputModule: ProcessTouchEvents()
    UnityEngine.EventSystems.StandaloneInputModule: Process()

    (Filename: currently not available on il2cpp Line: -1)
     
    Last edited: Mar 19, 2018
  2. thomas-weltenbauer

    thomas-weltenbauer

    Joined:
    Oct 23, 2013
    Posts:
    72
    When I compare your "SmtpSpecifiedPickupDirectoryElement" in the link.xml and the "SmtpSpecifiedPickupDirectoryElement" they're different! There is a strange charater between the "t" and "o" of the word "Directory".

    To cut a long story short:
    Copy "SmtpSpecifiedPickupDirectoryElement" from the error message and replace the existing one in your link.xml and it should work (we are using the same part in our link.xml).

     
    Last edited: Mar 19, 2018
    coeing and EchtMe like this.
  3. EchtMe

    EchtMe

    Joined:
    Jan 16, 2018
    Posts:
    10
    OMG how did you see this??? - it's working now.

    Vielen Dank :)
     
  4. thomas-weltenbauer

    thomas-weltenbauer

    Joined:
    Oct 23, 2013
    Posts:
    72
    I searched for typos. I copied "SmtpSpecifiedPickupDirectoryElement" from the error message and searched for it in you link.xml... so bascially... just luck :)
     
  5. EchtMe

    EchtMe

    Joined:
    Jan 16, 2018
    Posts:
    10
    Perfect, will remember this for the future - greetings to Germany.
     
    thomas-weltenbauer likes this.