Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Crash in PBXProjectData.WriteToString()

Discussion in 'iOS and tvOS' started by tmars, Jul 25, 2023.

  1. tmars

    tmars

    Joined:
    Jul 26, 2013
    Posts:
    42
    With 2022.3.5f1 our build pipeline is crashing on PBXProjectData.WriteToString() on a Win11 build agent:

    simple 19-Jul-2023 16:13:51 NullReferenceException: Object reference not set to an instance of an object
    simple 19-Jul-2023 16:13:51 at UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () [0x001e9] in <fde5c1e3700a463186cce16f247b09e3>:0
    simple 19-Jul-2023 16:13:51 at UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) [0x0006b] in <fde5c1e3700a463186cce16f247b09e3>:0
    simple 19-Jul-2023 16:13:51 at UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () [0x00081] in <fde5c1e3700a463186cce16f247b09e3>:0
    simple 19-Jul-2023 16:13:51 at UnityEditor.iOS.Xcode.PBXProject.WriteToString () [0x00001] in <fde5c1e3700a463186cce16f247b09e3>:0
    simple 19-Jul-2023 16:13:51 at Assets.Scripts.Editor.iOS.XcodeProjBuilderAgent.OnPostBuild (TM.Unity.Build.BuildParameters prms) [0x0006c]

    Anyone else facing this issue? Any workarounds?
     
    unityfortakeone likes this.
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,637
    Could you submit a bug report for this using Unity?
     
    juratedesigns likes this.
  3. okluskyond

    okluskyond

    Joined:
    Dec 6, 2017
    Posts:
    34
    Hi @tmars happened to me as well. It turned out I was adding singing capabilities twice which caused error for me. Try to go through your PostProcessBuildAttribute and verify any duplicities

    Edit: On duplicate through standard API you will get

    Code (CSharp):
    1. WarningException: This capability has already been added. Method ignored
    2. UnityEditor.iOS.Xcode.PBXProject.AddCapability (System.String targetGuid, UnityEditor.iOS.Xcode.PBXCapabilityType capability, System.String entitlementsFilePath, System.Boolean addOptionalFramework) (at <fde5c1e3700a463186cce16f247b09e3>:0)
    3. UnityEditor.iOS.Xcode.ProjectCapabilityManager.AddAssociatedDomains (System.String[] domains) (at <fde5c1e3700a463186cce16f247b09e3>:0)
    4. EntitlementsPostprocessor.OnPostProcessEntitlements2 (UnityEditor.BuildTarget target, System.String pathToBuiltProject) (at Assets/Editor/EntitlementsPostprocessor.cs:37)
    5. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eef08f56e2e042f1b3027eca477293d9>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    On duplicate with "nonofficial API" you will get

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () (at <fde5c1e3700a463186cce16f247b09e3>:0)
    3. UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) (at <fde5c1e3700a463186cce16f247b09e3>:0)
    4. UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () (at <fde5c1e3700a463186cce16f247b09e3>:0)
    5. UnityEditor.iOS.Xcode.PBXProject.WriteToString () (at <fde5c1e3700a463186cce16f247b09e3>:0)
    6. UnityEditor.iOS.Xcode.ProjectCapabilityManager.WriteToFile () (at <fde5c1e3700a463186cce16f247b09e3>:0)
    7. EntitlementsPostprocessor.OnPostProcessEntitlements4 (UnityEditor.BuildTarget target, System.String pathToBuiltProject) (at Assets/Editor/EntitlementsPostprocessor.cs:66)
    8. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eef08f56e2e042f1b3027eca477293d9>:0)
    9. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    10.  
    Like in our case where we have used AddSignInWithAppleWithCompatibility from plugin
     
    Last edited: Aug 2, 2023
    FMGdev likes this.
  4. okluskyond

    okluskyond

    Joined:
    Dec 6, 2017
    Posts:
    34
    I can provide repro project if you feel it should be handled by Unity. But it's code using reflection, and thus unpredictable from API point of view. Just in case you would see a possibility to improve logging somehow
     
  5. ikitae

    ikitae

    Joined:
    Oct 29, 2014
    Posts:
    2
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBXProject.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBXProject.WriteToFile (System.String path) (at <ca5baea5210f43dba4e79596749d3a36>:0)
    Facebook.Unity.PostProcess.DisableBitcode.OnPostProcessBuild (UnityEditor.BuildTarget buildTarget, System.String pathToBuildProject) (at Assets/Editor/DisableBitcode.cs:34)
    System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eaa95166e74c4ae1a419b6aa5baf90b9>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

    Code (CSharp):
    1. using System.IO;
    2. using UnityEngine;
    3. using UnityEditor;
    4. using UnityEditor.Build.Reporting;
    5. using UnityEditor.Callbacks;
    6. using UnityEditor.iOS.Xcode;
    7.  
    8. namespace Facebook.Unity.PostProcess
    9. {
    10.     /// <summary>
    11.     /// Automatically disables Bitcode on iOS builds
    12.     /// </summary>
    13. public static class DisableBitcode
    14. {
    15. [PostProcessBuildAttribute(999)]
    16. public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuildProject)
    17. {
    18. if (buildTarget != BuildTarget.iOS) return;
    19. string projectPath = pathToBuildProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
    20. PBXProject pbxProject = new PBXProject();
    21. pbxProject.ReadFromFile(projectPath);
    22.  
    23. //Disabling Bitcode on all targets
    24. //Main
    25. string target = pbxProject.GetUnityMainTargetGuid();
    26. pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    27. //Unity Tests
    28. target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
    29. pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    30. //Unity Framework
    31. target = pbxProject.GetUnityFrameworkTargetGuid();
    32. pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
    33.  
    34. pbxProject.WriteToFile(projectPath);
    35. }
    36. }
    37. }
    38.  
     
  6. bamboounity

    bamboounity

    Joined:
    Jul 16, 2020
    Posts:
    2
    2022.3.6f1 has same issue when building on Mac
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    3. UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) (at <ca5baea5210f43dba4e79596749d3a36>:0)
    4. UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    5. UnityEditor.iOS.Xcode.PBXProject.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
     
    unityfortakeone and FMGdev like this.
  7. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    90
    Same issue here. Started failing after upgrading from .3 to .6
     
  8. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    90
    Made a workaround by parsing the
    Unity-iPhone.xcodepro/project.pbxproj
    file line by line, replacing
    ENABLE_BITCODE = YES;
    with
    ENABLE_BITCODE = NO;
    for the time being.

    Sad to see another thing breaking in LTS version and not getting fixed in the next release. Also, I don't recall seeing anything in the changelog which might be related to the issue, both in .5 and 0.6 releases. Could be something around the lines of this changelog entry:
    • macOS: PBXProject.GetUnityMainTargetGuid now returns correct target. (UUM-39664)
    But this doesn't make sense as a getter should not affect serialization. Is this a silent change then?

    As a Pro-licensed user (to point out, a mandatory one), I find this completely unacceptable that literally anything can break outside of the scope of the changelog.
     
    Last edited: Aug 7, 2023
  9. juratedesigns

    juratedesigns

    Joined:
    Aug 6, 2023
    Posts:
    5
    the same here.
     
  10. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    > Started failing after upgrading from .3 to .6

    i cannot reproduce this locally with `pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");`
    can we have a bug report with repro project?
     
  11. michael_unity145

    michael_unity145

    Joined:
    Mar 8, 2022
    Posts:
    21
    Getting this as well on 2022.3.6f1, it did not happen in .3f1. We are not adding the same capability twice.. the call stack doesn't give much info

    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code 1.
    2. warning: Unknown file extension: lib
    3. warning: Unknown file extension: lib
    4. warning: Unknown file extension: lib
    5. warning: Unknown file extension: lib
    6. warning: Unknown file extension: lib
    7. warning: Unknown file extension: lib
    8. warning: Unknown file extension: lib
    9. warning: Unknown file extension: lib
    10. warning: Unknown file extension: lib
    11. warning: Unknown file extension: lib
    12. warning: Unknown file extension: lib
    13. warning: Unknown file extension: lib
    14. warning: Unknown file extension: lib
    15. warning: Unknown file extension: lib
    16. warning: Unknown file extension: lib
    17. warning: Unknown file extension: lib
    18. System.NullReferenceException: Object reference not set to an instance of an object.
    19.    at UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps()
    20.    at UnityEditor.iOS.Xcode.PBX.PBXObjectData.GetPropertiesRaw()
    21.    at UnityEditor.iOS.Xcode.PBXProject.SetTargetAttributes(String key, String value)
    22.    at iOSXcodeProject.SetupWriteProject(NPath targetFile, iOSFeatureValidator featureValidator, ObjectsFromDisk inputData)+MoveNext()
    23.    at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
    24.    at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
    25.    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    26.    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram() in /Users/bokken/build/output/unity/unity/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary/PlayerBuildProgramBase.cs:line 182
    27.    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    28.    at Program.Main(String[] args)
    29. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)
    30.  
     
  12. juratedesigns

    juratedesigns

    Joined:
    Aug 6, 2023
    Posts:
    5
    so when i remove admob the prject builds, but when i try to integrate yodo1 instead of admob the project fails as well with the same error messages. so it is not admob nor yodo. it is unity. in 2022.3.4 this was not happening but there was another bug with animation curves, so I upgraded first to 2022.3.6, and this issue appeared, nd then I upgraded to 2022.3.7 and this issue still persists. WHEN WILL I BE ABLE TO BUILD? This is really frustrating.

    UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    UnityEditor.iOS.Xcode.PBXProject.WriteToString () (at <ca5baea5210f43dba4e79596749d3a36>:0)
    Google.IOSResolver.AddDummySwiftFile (UnityEditor.BuildTarget buildTarget, System.String pathToBuiltProject) (at /Users/drsanta/dev/tmp/unity-jar-resolver/source/IOSResolver/src/IOSResolver.cs:2127)
    Google.IOSResolver.OnPostProcessAddDummySwiftFile (UnityEditor.BuildTarget buildTarget, System.String pathToBuiltProject) (at /Users/drsanta/dev/tmp/unity-jar-resolver/source/IOSResolver/src/IOSResolver.cs:1995)
    System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <16d1a1e3fafa4d23a275526c945e1b62>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)
     
    KyleVT and michael_unity145 like this.
  13. SerdarUrkmez1

    SerdarUrkmez1

    Joined:
    May 22, 2023
    Posts:
    1
    In 2022.3.5, I downgraded to 2022.2.2 because of this problem. Now I've upgraded it back to 3.7 to use Analytics 5.0. Still the same problem. I'm confused why LTS is updated to a version and the build issue is still not resolved
     
    novaVision likes this.
  14. atifraheem48

    atifraheem48

    Joined:
    Aug 24, 2019
    Posts:
    11
    I am having the same issue. I just upgraded my codebase from unity version 2021.x to 2022.3.5f1 and started facing this issue. Nothing was changed from previous STABLE code base to the current one. except upgrading unity version.
     
  15. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    363
    Same problem after upgrading from 2022.3.4f1 to 2022.3.6f1 on Intel Mac. Upgrade to 2022.3.7f1 didn't help. Reverting back to 2022.3.4f1 solved the issue.

    BuildFailedException: Player build failed: Internal build system error. BuildProgram exited with code 1.
    System.NullReferenceException: Object reference not set to an instance of an object.
    at UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps()
    at UnityEditor.iOS.Xcode.PBX.PBXObjectData.GetPropertiesRaw()
    at UnityEditor.iOS.Xcode.PBXProject.SetTargetAttributes(String key, String value)
    at iOSXcodeProject.SetupWriteProject(NPath targetFile, iOSFeatureValidator featureValidator, ObjectsFromDisk inputData)+MoveNext()
    at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
    at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram() in /Users/bokken/build/output/unity/unity/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary/PlayerBuildProgramBase.cs:line 182
    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    at Program.Main(String[] args)
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:718)
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <cd213be5c0a6467182bf9949d7af5626>:0)
    UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
    MarbleBuild:Build() (at Assets/Scripts/editor/MarbleBuild.cs:35)
     
    Last edited: Aug 11, 2023
  16. tmars

    tmars

    Joined:
    Jul 26, 2013
    Posts:
    42
    @Aurimas-Cernius @Alexey still no luck with 2022.3.7f1, the issue first appeared in 2022.3.5f1. Unfortunately we can't provide a repo project, will submitting a bug without the project help to escalate the issue?
     
  17. michael_unity145

    michael_unity145

    Joined:
    Mar 8, 2022
    Posts:
    21
    Any updates on this issue, or known workarounds? We rolled back to 2022.3.3f1 and can't upgrade until it gets resolved.

    Tried removing all of our iOS build post processing code (although plugins excluded), but still getting the same issue
     
  18. tmars

    tmars

    Joined:
    Jul 26, 2013
    Posts:
    42
    @Aurimas-Cernius @Alexey no luck with 2022.3.8f1, the same story here:

    NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps () [0x001e9] in <fde5c1e3700a463186cce16f247b09e3>:0
    at UnityEditor.iOS.Xcode.PBX.KnownSectionBase`1[T].WriteSection (System.Text.StringBuilder sb, UnityEditor.iOS.Xcode.PBX.GUIDToCommentMap comments) [0x0006b] in <fde5c1e3700a463186cce16f247b09e3>:0
    at UnityEditor.iOS.Xcode.PBXProjectData.WriteToString () [0x00081] in <fde5c1e3700a463186cce16f247b09e3>:0
    at UnityEditor.iOS.Xcode.PBXProject.WriteToString () [0x00001] in <fde5c1e3700a463186cce16f247b09e3>:0

    tested on both windows & macos, all 3rd party plugins removed & etc.
     
  19. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    can anybody in this thread submit a bug report with a repro project? As i said we do NOT see these crashes when tested locally
     
  20. plotlessplot

    plotlessplot

    Joined:
    Sep 16, 2012
    Posts:
    28
    Same issue here. Started happening on Unity 2022.3.4f1 and happens in every Unity version up to (and including) 2022.3.8f1.

    Every single call to UnityEditor.iOS.Xcode.PBX.PBXProjectObjectData.UpdateProps() (which, in our case, happens when we call .WriteToFile() on a PBXProject or ProjectCapabilityManager instance) throws an NRE. We have multiple plugins that apply changes/add entitlements when building for iOS (e.g. AppLovin MAX, Facebook SDK, Adjust, etc) and they all fail when they call those methods.

    Currently, the only way to have a successful iOS build is to open the project with Unity 2022.3.3f1 and build from there.

    I've just attempted to create a repro project with a couple of the scripts that are causing issues on our main project, but the repro project builds correctly, with no issues, which is even stranger. I've also attempted to take our main project and delete everything except a few of the scripts that are throwing NREs but, again, everything works.

    Not sure what's happening and what was introduced in 2022.3.4f1+ to make it throw these exceptions (again, in 2022.3.3f1 and lower, everything works as expected).

    As you might expect, sharing our full project is not an option, so do you have any idea what we can do on our side to help track this thing down?
     
    michael_unity145 likes this.
  21. dankorenev

    dankorenev

    Joined:
    Jul 1, 2022
    Posts:
    5
    @Aurimas-Cernius @Alexey turns out that we have plugin which is creating custom capability like this:
    Code (CSharp):
    1. var capabilityType = constructorInfo.Invoke(new object[] { "com.apple.developer.applesignin.custom", true, string.Empty, true }) as PBXCapabilityType;
    2. project.AddCapability(mainTargetGuid, capabilityType, entitlementFilePath, false);
    IF there are other postprocessors, which are executed later than the one above and if they call pbxproj.WriteToString(), then they end up with null reference. And it started to fail only since 2022.3.4.
    The problem here is in the id of capability. If I change it to "com.apple.developer.applesignin" everything works fine again.
     
    Last edited: Aug 30, 2023
  22. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    Can i kindly mention that this uses private constructor? 8)
    Yeah, can reproduce the crash - while i cannot condone using reflection like this should fail better (well, not crash at least)
     
  23. dankorenev

    dankorenev

    Joined:
    Jul 1, 2022
    Posts:
    5
    Well, it's a code from 3rd party plugin, so all the questions to the creators) https://github.com/lupidan/apple-signin-unity
     
  24. plotlessplot

    plotlessplot

    Joined:
    Sep 16, 2012
    Posts:
    28
    Can confirm that the issue is 100% reproducible by adding the AppleSignInUnity plugin to our project. In my previous attempt at creating a repro project I did not add this plugin because I believed the issue lied elsewhere.

    We are using this plugin (which Unity recommends in its own documentation for the Authentication package) to handle signing in with Apple. Up until 2022.3.3f1 everything was working correctly, though, and only on 2022.3.4f1 did we start seeing issues.

    The plugin has not been updated since 2021, so I'm unsure if this is something that can be fixed on Unity's side or if the plugin is simply doing something that is deprecated/obsolete/not supported.
     
  25. IgorBoyko

    IgorBoyko

    Joined:
    Sep 28, 2020
    Posts:
    90
    I can confirm we are also using AppleSignInUnity plugin mentioned above.
     
  26. dankorenev

    dankorenev

    Joined:
    Jul 1, 2022
    Posts:
    5
    Just to be clear. The easiest fix - you can replace "com.apple.developer.applesignin.custom" with "com.apple.developer.applesignin" in the plugins' code.
     
  27. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    160
    Getting the same issue and using the same Apple Sign In plugin as others mentioned. Whats the best way to work around this then?
     
  28. dankorenev

    dankorenev

    Joined:
    Jul 1, 2022
    Posts:
    5
    There's an extension method called AddSignInWithAppleWithCompatibility. Replace "com.apple.developer.applesignin.custom" with "com.apple.developer.applesignin" in it. Or try to use this code instead of postprocessor example in the plugin's description:
    Code (CSharp):
    1. public static void OnPostProcessBuild(BuildTarget target, string path)
    2. {
    3.     if (target == BuildTarget.iOS || target == BuildTarget.tvOS)
    4.     {
    5.         var projectPath = PBXProject.GetPBXProjectPath(path);
    6.         var project = new PBXProject();
    7.         project.ReadFromString(System.IO.File.ReadAllText(projectPath));
    8.        
    9.         var mainTargetGuid = project.GetUnityMainTargetGuid();
    10.         var entitlementFilePath = project.GetEntitlementFilePathForTarget(mainTargetGuid);
    11.         project.AddCapability(mainTargetGuid, PBXCapabilityType.SignInWithApple, entitlementFilePath, false);
    12.         project.WriteToFile(projectPath);
    13.  
    14.         string entitlementsPath = Path.Combine(path, entitlementFilePath);
    15.         PlistDocument entitlements = new PlistDocument();
    16.         entitlements.ReadFromString(File.ReadAllText(entitlementsPath));
    17.         PlistElementDict entitlementsDict = entitlements.root;
    18.         var arr = entitlementsDict.CreateArray("com.apple.developer.applesignin");
    19.         arr.AddString("Default");
    20.         File.WriteAllText(entitlementsPath, entitlements.WriteToString());      
    21.     }
    22.     else if (target == BuildTarget.StandaloneOSX)
    23.     {
    24.         AppleAuthMacosPostprocessorHelper.FixManagerBundleIdentifier(target, path);
    25.     }
    26. }
     
    ErezShahaf and tmars like this.
  29. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    160
    Thanks for the info - got that working now - cheers :)
     
    dankorenev likes this.
  30. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    just in case we have a fix for this and doing backports (you could track the progress if there was some bug reported...)
     
    IgorBoyko likes this.
  31. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,002
    Tell a Unity intern to get on that.
     
  32. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    We're also seeing this but not using the plugin mentioned above. We are using firebase, and the issue doesn't happen when we removed firebase. Our work-around was to move all of our own post-processing scripts to happen after firebase has done it own post-processing.
     
  33. msnz

    msnz

    Joined:
    Nov 4, 2020
    Posts:
    31
    Was having this issue too and I'm also using the Apple Sign-in plugin.

    @dankorenev 's solution works for me, but I wish this would be officially addressed/fixed by Unity.
     
  34. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    491
    I don't use Apple Sign In, but have similar issue - only XCode build by a replacement works but this takes tons of time fox XCode to compile everything again.

    Any general workaround for that problem?
     
  35. andrii-gorishnii

    andrii-gorishnii

    Joined:
    Jul 5, 2023
    Posts:
    1
    @Alexey any update on the progress of backporting? When can we expect the fix in 2022.3.x LTS versions?
     
  36. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    > any update on the progress of backporting? When can we expect the fix in 2022.3.x LTS versions?
    Unless something happens: 2022.3.10 (as in the next one)
     
    andrii-gorishnii likes this.