Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2019.3.0b3/0b4 "Calling TargetGuidByNameWithName="Unity-iPhone" is deprecated. (Wont build)

Discussion in '2019.3 Beta' started by Chrono14, Sep 22, 2019.

  1. Chrono14

    Chrono14

    Joined:
    Jan 14, 2018
    Posts:
    1
    Hi guys,

    I tried with both 2019.3.0b3 and 0b4 on a nearly empty project and I'm getting the error:
    "Exception: Calling TargetGuidByName with name='Unity-iPhone' is deprecated. There are two targets now, call GetUnityMainTargetGuid() - for app or GetUnityFrameworkTargetGuid() - for source/plugins to get Guid instead."

    I'm not sure if this is a bug or a setting somewhere. Googling around led to a patch back in June, but it didn't appear to fix anything for anyone and I was posting here for advice. The project will not build right now because of this.

    An empty project works just fine, but one upgraded from a previous version does not.

    The log his here and it appears to be coming from an ad framework even though I have no ads in my project:
    Exception: Calling TargetGuidByName with name='Unity-iPhone' is deprecated. There are two targets now, call GetUnityMainTargetGuid() - for app or GetUnityFrameworkTargetGuid() - for source/plugins to get Guid instead.
    UnityEditor.iOS.Xcode.PBXProject.TargetGuidByName (System.String name) (at /Users/builduser/buildslave/unity/build/External/XcodeAPI/Xcode/PBXProject.cs:168)
    UnityEditorInternal.Advertisements.UnityAdsPostprocessor.EditXcodeProject (System.String buildFolder) (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAdsEditor/UnityAdsPostprocessor.cs:101)
    UnityEditorInternal.Advertisements.UnityAdsPostprocessor.PostProcessBuild_iOS (UnityEditor.BuildTarget target, System.String path) (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAdsEditor/UnityAdsPostprocessor.cs:92)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
    UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnPostprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:177)
    UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass17_0.<OnBuildPostProcess>b__1 (UnityEditor.Build.IPostprocessBuildWithReport bpp) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:433)
    UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:391)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
    rushjs likes this.
  2. DeliaF_Manea

    DeliaF_Manea

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    25
    Hi,

    Remove ads package unless you need it. If you need it, upgrade your ads package to version 3.
     
  3. EmadKurd

    EmadKurd

    Joined:
    Oct 23, 2017
    Posts:
    4
    Go to File / Build Setting
    in build setting run in Xcode choose the Xcode version that installed on your apple device
     
    MartinMajewski_LHIND likes this.
  4. chachi

    chachi

    Joined:
    Apr 7, 2014
    Posts:
    3
    In my case, the problem persisted after removing the ads package. It turned out that one of my plugins was using this outdated function. I did a global code search for `TargetGuidByName` that led me to the culprit line so that I could update it.
     
    Darshanpreet, solargame12 and efge like this.
  5. thegladscientist

    thegladscientist

    Joined:
    Jun 11, 2017
    Posts:
    3
    Updating ads worked for me. :)
     
  6. amazingamazing

    amazingamazing

    Joined:
    Jul 17, 2018
    Posts:
    2
    If you're having difficulty figuring out how to update ads (like me, who never even turned them on)...

    How to update:
    Go to Window > Package Manager
    Find a tab called 'Ads' or 'Advertisement'
    Select 3.2.0 from the 'Ads' dropdown menu
    Click 'Update to 3.2.0'

    (stolen from some other post that I forget the link to)
     
    donutdan and tylerwongj like this.
  7. BantuMaweni

    BantuMaweni

    Joined:
    Jan 26, 2019
    Posts:
    1
    How did you update the lines?
     
  8. efge

    efge

    Joined:
    Dec 13, 2007
    Posts:
    62
    Replace
    TargetGuidByName("Unity-iPhone")

    with
    GetUnityMainTargetGuid()
     
    PlayAndGo, lumeneo, rushjs and 3 others like this.
  9. qoobit

    qoobit

    Joined:
    Aug 19, 2014
    Posts:
    51
    This function currently updates all references in the target but not the project for the build. Upon compiling, you still need to manually copy over the post build processes to the main project. Still trying to see if Unity made another way to reference the project as a Guid as PBXProject.ProjectGuid currently causes a compile error when used in place of PBXProject.GetUnityMainTargetGuid.
     
  10. microperts

    microperts

    Joined:
    Jan 25, 2016
    Posts:
    11
    In which file exactly?
     
  11. paulparkinson

    paulparkinson

    Joined:
    Nov 10, 2019
    Posts:
    1
    In my case it was NativeToolKit that was doing this and so I changed in in PostProcessor.cs which was under Assets->NativeToolKit->Editor
     
    rushjs and microperts like this.
  12. drewjosh

    drewjosh

    Joined:
    Sep 24, 2019
    Posts:
    28
    That was the solution! Thanks a lot!!
     
    rozan_stha likes this.
  13. Darshanpreet

    Darshanpreet

    Joined:
    Sep 26, 2013
    Posts:
    5

    Worked for me
     
  14. MartinMajewski_LHIND

    MartinMajewski_LHIND

    Joined:
    Sep 7, 2021
    Posts:
    1
    This solved the problem for me! Thanks!

    Edit: Or at least I thought so. I can build, but I cannot "build and run". Building the project solely succeeds, but opening XCode automatically afterward produces the same error, and a failed built.