Skip to content

Commit

Permalink
fix bugs. You need move Build Phase "Unity Process symbols for Unity-…
Browse files Browse the repository at this point in the history
  • Loading branch information
botaohu committed Nov 10, 2023
1 parent 253e75e commit dd0c791
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ public class HoloKitWatchAppBuildProcessor

private const string HealthUpdateUsageDescription = "Workouts tracked by HoloKit app on Apple Watch will be saved to HealthKit.";

private static int FindBuildPhaseIndex(PBXProject project, string targetGuid, string buildPhaseName)
{
var buildPhaseGuids = project.GetAllBuildPhasesForTarget(targetGuid);
//find the index of the build phase
for (int i = 0; i < buildPhaseGuids.Length; i++)
{
if (project.GetBuildPhaseName(buildPhaseGuids[i]) == buildPhaseName)
{
return i;
}
}
return buildPhaseGuids.Length;
}

// https://github.com/Manurocker95/IronRuby-Test/blob/57f8b66e88d7df2e9bd7936e83777a79427f8e13/Assets/VirtualPhenix/Scripts/Editor/AppleWatch/VP_SetupWatchExtension.cs
[PostProcessBuild]
private static void AppleWatchSetup(BuildTarget target, string buildPath)
Expand All @@ -34,7 +48,7 @@ private static void AppleWatchSetup(BuildTarget target, string buildPath)

if (watchAppTargetGuid != null)
{
Debug.Log(watchAppTargetGuid);
Debug.Log("Watch App Target exists. GUID: " + watchAppTargetGuid);
}
else
{
Expand All @@ -52,7 +66,8 @@ private static void AppleWatchSetup(BuildTarget target, string buildPath)
// Prevent duplication
if (project.GetCopyFilesBuildPhaseByTarget(mainTargetGuid, "Embed Watch Content", "$(CONTENTS_FOLDER_PATH)/Watch", "16") == null)
{
string sectionGuid = project.AddCopyFilesBuildPhase(mainTargetGuid, "Embed Watch Content", "$(CONTENTS_FOLDER_PATH)/Watch", "16");
int insertionIndex = FindBuildPhaseIndex(project, mainTargetGuid, "Unity Process symbols for Unity-iPhone");
string sectionGuid = project.InsertCopyFilesBuildPhase(insertionIndex, mainTargetGuid, "Embed Watch Content", "$(CONTENTS_FOLDER_PATH)/Watch", "16");
project.AddFileToBuildSection(mainTargetGuid, sectionGuid, project.GetTargetProductFileRef(watchAppTargetGuid));
}

Expand Down

0 comments on commit dd0c791

Please sign in to comment.