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

Question XCode 15 Cycle inside Unity-iPhone; building could produce unreliable results.

Discussion in 'iOS and tvOS' started by BSGDevelopment, Sep 27, 2023.

  1. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    I had to update to XCode 15 for the new iOS17. I first ran into the phasescriptexecution issue and solved it by installed XCode Beta 5 along side in the applications folder (per this post: https://forum.unity.com/threads/upg...tion-failed-with-a-nonzero-exit-code.1493900/).

    But now when I build I get this error: Cycle inside Unity-iPhone; building could produce unreliable results.

    Any thoughts on a solution? Thanks.
     
  2. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    Here is the full error:

    Cycle inside Unity-iPhone; building could produce unreliable results.

    Cycle details:

    → Target 'Unity-iPhone': CodeSign /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app

    ○ Target 'Unity-iPhone' has process command with output '/Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist'

    ○ Target 'Unity-iPhone' has copy command from '/Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/notificationservice.appex' to '/Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/PlugIns/notificationservice.appex'

    ○ That command depends on command in Target 'Unity-iPhone': script phase “Unity Process symbols for Unity-iPhone”

    ○ Target 'Unity-iPhone' has a command with output '/Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app.dSYM'



    Raw dependency cycle trace:


    target: ->


    node: <all> ->


    command: <all> ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/_CodeSignature ->


    command: P0:target-Unity-iPhone-<anotherlongstring>-:Debug:CodeSign /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist/ ->


    directoryTreeSignature: � ->


    directoryContents: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist ->


    CYCLE POINT ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist ->


    command: P0:target-Unity-iPhone-<anotherlongstring>-:Debug:processInfoPlistFile /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist /Users/<user>/Documents/GitHub.nosync/BSBJ-MobileApp/Build/iOS/Info.plist ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/PlugIns/notificationservice.appex ->


    command: P0:target-Unity-iPhone-<anotherlongstring>-:Debug:Copy /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/PlugIns/notificationservice.appex /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/notificationservice.appex ->


    node: <target-Unity-iPhone-<anotherlongstring>--fused-phase4-unity-process-symbols-for-unity-iphone> ->


    command: P0:::Gate target-Unity-iPhone-<anotherlongstring>--fused-phase4-unity-process-symbols-for-unity-iphone ->


    node: <execute-shell-script-4d46f0999f4e53d6791a1877ccf164d7b4bb0224e304c7959f223177dc1c75b9-target-Unity-iPhone-<anotherlongstring>-> ->


    command: P2:target-Unity-iPhone-<anotherlongstring>-:Debug:phaseScriptExecution Unity Process symbols for Unity-iPhone /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Script-D4BF5B853AEA9FBFC39E33E9.sh ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app.dSYM/Contents/Resources/DWARF/<appname> ->


    command: P0:target-Unity-iPhone-<anotherlongstring>-:Debug:GenerateDSYMFile /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app.dSYM /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/<appname> ->


    node: /Users/<user>/Library/Developer/Xcode/DerivedData/Unity-iPhone-<longstring>/Build/Products/Debug-iphoneos/<appname>.app/Info.plist
     
  3. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    Solved! I moved Embed Frameworks and Embed App Extensions further up (2nd and 3rd) respectively) in build phases in xcode. Unfortunately, it seems you have to do this every time you generate a new build from Unity. But it works. The solution was in this post but I had scroll past the answer to find the fact that it may take moving both of those to work.
     
  4. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    we are working on a fix, if somebody comes here from search: you can move "Unity Process symbols for Unity-iPhone" to be last (you can drag and drop in xcode):
    Screenshot 2023-10-09 at 07.49.41.png
     
  5. vkhylchuk

    vkhylchuk

    Joined:
    Apr 1, 2021
    Posts:
    8
    Hi.
    Some code:

    Code (CSharp):
    1. namespace YourNameSpace
    2. {
    3.     internal static class FixBuildPhasesOrderForUnityIPhone
    4.     {
    5.         private const string _sectionSearchKey = "Build configuration list for PBXNativeTarget \"Unity-iPhone\"";
    6.         private const string _targetBuildPhaseKey = "Unity Process symbols";
    7.  
    8.         [PostProcessBuild(45)]
    9.         private static void FixBuildPhasesOrderInProject(BuildTarget target, string pathToBuiltProject)
    10.         {
    11.             if (target != BuildTarget.iOS)
    12.             {
    13.                 return;
    14.             }
    15.  
    16.             // Search for order array.
    17.             var path = Path.Combine(pathToBuiltProject, "Unity-iPhone.xcodeproj", "project.pbxproj");
    18.             var allLines = File.ReadAllLines(path);
    19.  
    20.             // Search for first line.
    21.             var firstLine = -1;
    22.             for (var i = 0; i + 2 < allLines.Length; i++)
    23.             {
    24.                 if (allLines[i].Contains(_sectionSearchKey) && allLines[i + 1].Contains("buildPhases = ("))
    25.                 {
    26.                     firstLine = i + 2;
    27.                     break;
    28.                 }
    29.             }
    30.  
    31.             // Check for error.
    32.             if (firstLine <= 0)
    33.             {
    34.                 return;
    35.             }
    36.  
    37.             // Search for last line.
    38.             var lastLine = -1;
    39.             for (var i = firstLine; i + 1 < allLines.Length && i - firstLine < 30; i++)
    40.             {
    41.                 if (allLines[i + 1].Contains(");"))
    42.                 {
    43.                     lastLine = i;
    44.                     break;
    45.                 }
    46.             }
    47.  
    48.             // Check for error.
    49.             if (lastLine <= 0 || lastLine == firstLine)
    50.             {
    51.                 return;
    52.             }
    53.  
    54.             var buffer = new List<string>();
    55.             for (var i = firstLine; i <= lastLine; i++)
    56.             {
    57.                 buffer.Add(allLines[i]);
    58.             }
    59.  
    60.             var index = buffer.FindIndex(x => x.Contains(_targetBuildPhaseKey));
    61.             if (index == -1)
    62.             {
    63.                 return;
    64.             }
    65.  
    66.             var line = buffer[index];
    67.             buffer.RemoveAt(index);
    68.             buffer.Add(line);
    69.  
    70.             // Replace old lines with new ones.
    71.             for (var i = 0; i < buffer.Count; i++)
    72.             {
    73.                 allLines[firstLine + i] = buffer[i];
    74.             }
    75.  
    76.             // Save results.
    77.             File.WriteAllLines(path, allLines);
    78.             Debug.Log("BuildPhases order were reordered in xCode project.");
    79.         }
    80.     }
    81. }
     
  6. MTeplytskyi

    MTeplytskyi

    Joined:
    Jun 16, 2020
    Posts:
    25
    Hi! Do you have any ETA for this fix for Unity 2021/2022?