Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Ads failed to work with IL2CPP on iOS

Discussion in 'Unity Ads & User Acquisition' started by StevenCheng, Feb 3, 2015.

  1. StevenCheng

    StevenCheng

    Joined:
    Sep 25, 2013
    Posts:
    2
    **********SOLVED*********


    It is all fine until we have shifted our scripting backend with IL2CPP. Unfortunately it seems like it is an option that we must opt for before we can submit our new App to iTunes Connect.

    We have received the following report under Xcode when our App is trying to call UnityAds:
    *****
    Code (CSharp):
    1. NullReferenceException: A null value was found where an object instance was required.
    2.   at <PrivateImplementationDetails>..ctor () [0x00000] in <filename unknown>:0
    3.   at UnityEngine.Advertisements.HTTPLayer.HTTPRequest+<executePost>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
    4.   at Replacements.Attribute.CheckParameters (System.Object element, System.Type attributeType) [0x00000] in <filename unknown>:0
    5.   at UnityEngine.MonoBehaviour.StartCoroutine_Auto (IEnumerator routine) [0x00000] in <filename unknown>:0
    6.   at UnityEngine.MonoBehaviour.StartCoroutine (IEnumerator routine) [0x00000] in <filename unknown>:0
    7.   at UnityEngine.Advertisements.AsyncExec.runWithCallback[HTTPRequest,HTTPResponse] () [0x00000] in <filename unknown>:0
    8.   at UnityEngine.Advertisements.HTTPLayer.HTTPResponse..ctor () [0x00000] in <filename unknown>:0
    9.   at UnityEngine.Advertisements.HTTPLayer.HTTPRequest.execute (System.Action`1 callback) [0x00000] in <filename unknown>:0
    10.   at UnityEngine.Advertisements.HTTPLayer.RetryRequest.retry () [0x00000] in <filename unknown>:0
    11.   at System.Action.Invoke () [0x00000] in <filename unknown>:0
    12.   at <PrivateImplementationDetails>..ctor () [0x00000] in <filename unknown>:0
    13.   at UnityEngine.Advertisements.AsyncExec+<delayedCallback>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0
    14.   at Replacements.Attribute.CheckParameters (System.Object element, System.Type attributeType) [0x00000] in <filename unknown>:0
    15. Replacements.Attribute:CheckParameters(Object, Type)
    16. UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    17. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    18. UnityEngine.Advertisements.AsyncExec:runWithCallback()
    19. UnityEngine.Advertisements.HTTPLayer.HTTPResponse:.ctor()
    20. UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action`1)
    21. UnityEngine.Advertisements.HTTPLayer.RetryRequest:retry()
    22. System.Action:Invoke()
    23. <PrivateImplementationDetails>:.ctor()
    24. UnityEngine.Advertisements.<delayedCallback>c__Iterator2:MoveNext()
    25. Replacements.Attribute:CheckParameters(Object, Type)
    26. (Filename: currently not available on il2cpp Line: -1)
    ***

    Looks like it is being caused by the absence of WebRequest/WebClient API with Unity 4.6.2 iOS 64bit support? Anyone have a solution getting UnityAds working with a 64bit iOS App?
     
    Last edited: Feb 4, 2015
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    You should have a file called link.xml in your Assets folder with the following contents:
    Code (XML):
    1. <linker>
    2.     <assembly fullname="UnityEngine">
    3.         <type fullname="UnityEngine.WWW" preserve="all" />
    4.     </assembly>
    5. </linker>
    Does that file still exist in the Assets folder of your project?
     
    taxvi likes this.
  3. StevenCheng

    StevenCheng

    Joined:
    Sep 25, 2013
    Posts:
    2
    Dear Sir .. you're certainly a life saver. It is functioning under 64bits architecture as it used to be now. I hope I can know more the reason for this!

    Many many thanks.
     
  4. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
  5. ducanhtuvu

    ducanhtuvu

    Joined:
    Jul 22, 2012
    Posts:
    20
    :) thanks you Nikkolai..