From 53c7890ee57c31cb58f74490872400faa2aea2c3 Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 20:21:27 -0400 Subject: [PATCH] Add helper method for disabling bitcode --- .../Editor/BuildPostProcessor.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs b/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs index 36441b819..ff0784208 100644 --- a/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs +++ b/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs @@ -111,13 +111,7 @@ public void OnPostprocessBuild(BuildReport report) { // Add the service extension AddNotificationServiceExtension(); - // Unity Tests - var unityTests = _project.TargetGuidByName(PBXProject.GetUnityTestTargetName()); - _project.SetBuildProperty(unityTests, "ENABLE_BITCODE", "NO"); - - // Unity Framework - var unityFramework = _project.GetUnityFrameworkTargetGuid(); - _project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO"); + DisableBitcode(); // Save the project back out File.WriteAllText(_projectPath, _project.WriteToString()); @@ -160,8 +154,6 @@ private void AddProjectCapabilities() { var targetGuid = _project.GetMainTargetGuid(); var targetName = _project.GetMainTargetName(); - _project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); - var entitlementsPath = GetEntitlementsPath(targetGuid, targetName); var projCapability = new ProjectCapabilityManager(_projectPath, entitlementsPath, targetName); @@ -293,6 +285,20 @@ private void ExtensionAddPodsToTarget() { File.WriteAllText(podfilePath, podfile); } + + private void DisableBitcode() { + // Main + var targetGuid = _project.GetMainTargetGuid(); + _project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO"); + + // Unity Tests + var unityTests = _project.TargetGuidByName(PBXProject.GetUnityTestTargetName()); + _project.SetBuildProperty(unityTests, "ENABLE_BITCODE", "NO"); + + // Unity Framework + var unityFramework = _project.GetUnityFrameworkTargetGuid(); + _project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO"); + } } } #endif \ No newline at end of file