From 04a88c38c06e823739694e2f4b71d0fd835af61f Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 00:50:23 -0400 Subject: [PATCH 1/5] Disable bitcode for all targets --- com.onesignal.unity.ios/Editor/BuildPostProcessor.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs b/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs index b61eace91..36441b819 100644 --- a/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs +++ b/com.onesignal.unity.ios/Editor/BuildPostProcessor.cs @@ -111,6 +111,14 @@ 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"); + // Save the project back out File.WriteAllText(_projectPath, _project.WriteToString()); } @@ -152,6 +160,8 @@ 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); @@ -191,6 +201,7 @@ private void AddNotificationServiceExtension() { _project.SetBuildProperty(extensionGuid, "SWIFT_VERSION", "5.0"); _project.SetBuildProperty(extensionGuid, "ARCHS", "arm64"); _project.SetBuildProperty(extensionGuid, "DEVELOPMENT_TEAM", PlayerSettings.iOS.appleDeveloperTeamID); + _project.SetBuildProperty(extensionGuid, "ENABLE_BITCODE", "NO"); _project.AddBuildProperty(extensionGuid, "LIBRARY_SEARCH_PATHS", $"$(PROJECT_DIR)/Libraries/{PluginLibrariesPath.Replace("\\", "/")}"); From e446c5b70316133f4ff09a9d2acb5dbcd309d89d Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 00:52:42 -0400 Subject: [PATCH 2/5] Add bitcode build error to troubleshooting guide --- MIGRATION_GUIDE_v3_to_v5.md | 13 +++++++++++-- .../Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/MIGRATION_GUIDE_v3_to_v5.md b/MIGRATION_GUIDE_v3_to_v5.md index 62a683f27..7f45d39a8 100644 --- a/MIGRATION_GUIDE_v3_to_v5.md +++ b/MIGRATION_GUIDE_v3_to_v5.md @@ -250,7 +250,7 @@ The debug namespace is accessible via `OneSignal.Debug` and provides access to d - We will be introducing JWT in a follow up release # Troubleshooting - +## Android ``` Assets/OneSignal/Example/OneSignalExampleBehaviou.cs: error CS0246: The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?) ``` @@ -283,4 +283,13 @@ Execution failed for task ':launcher:mergeReleaseJavaResource'. 1. Go to **Player Settings** and click the Android Tab. Under **Publishing Settings**, enable the following: - Custom Main Gradle Template - Custom Gradle Properties Template -2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve** \ No newline at end of file +2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve** + +## iOS +**Build error** +``` +'/Users/.../Library/Developer/Xcode/DerivedData/Unity-iPhone-.../Build/Products/ReleaseForRunning-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignalCore/OneSignalCore.framework/OneSignalCore' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/.../Library/Developer/Xcode/DerivedData/Unity-iPhone-.../Build/Products/ReleaseForRunning-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignalCore/OneSignalCore.framework/OneSignalCore' for architecture arm64 +``` + +1. For each target, select the **Build Settings** tab +2. Set **Enable Bitcode** to **No** \ No newline at end of file diff --git a/OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md b/OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md index 62a683f27..7f45d39a8 100644 --- a/OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md +++ b/OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md @@ -250,7 +250,7 @@ The debug namespace is accessible via `OneSignal.Debug` and provides access to d - We will be introducing JWT in a follow up release # Troubleshooting - +## Android ``` Assets/OneSignal/Example/OneSignalExampleBehaviou.cs: error CS0246: The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?) ``` @@ -283,4 +283,13 @@ Execution failed for task ':launcher:mergeReleaseJavaResource'. 1. Go to **Player Settings** and click the Android Tab. Under **Publishing Settings**, enable the following: - Custom Main Gradle Template - Custom Gradle Properties Template -2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve** \ No newline at end of file +2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve** + +## iOS +**Build error** +``` +'/Users/.../Library/Developer/Xcode/DerivedData/Unity-iPhone-.../Build/Products/ReleaseForRunning-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignalCore/OneSignalCore.framework/OneSignalCore' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/.../Library/Developer/Xcode/DerivedData/Unity-iPhone-.../Build/Products/ReleaseForRunning-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignalCore/OneSignalCore.framework/OneSignalCore' for architecture arm64 +``` + +1. For each target, select the **Build Settings** tab +2. Set **Enable Bitcode** to **No** \ No newline at end of file From 06be74de13da4834a3fa1fe19cd5920c4178c5a6 Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 00:53:56 -0400 Subject: [PATCH 3/5] Add note to disable bitcode --- OneSignalExample/Assets/OneSignal/README.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/OneSignalExample/Assets/OneSignal/README.md b/OneSignalExample/Assets/OneSignal/README.md index c742bb8da..1fafb1dfc 100644 --- a/OneSignalExample/Assets/OneSignal/README.md +++ b/OneSignalExample/Assets/OneSignal/README.md @@ -119,6 +119,8 @@ After building in Unity and exporting the XCode project follow these steps: 6. **App Groups** should now be provisioned for you going forward for your iOS bundle id, even on clean builds. +7. Make sure all **Targets** have **Enable Bitcode** set to **No** in **Build Settings**. + ### Android Most of the Android setup was already handled during installation! diff --git a/README.md b/README.md index f9b472682..eeca06610 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,8 @@ After building in Unity and exporting the XCode project follow these steps: 6. **App Groups** should now be provisioned for you going forward for your iOS bundle id, even on clean builds. +7. Make sure all **Targets** have **Enable Bitcode** set to **No** in **Build Settings**. + ### Android In the Unity editor: From fe5b4c2ef3689609b11eb04ddd11b823c25d379c Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 19:51:58 -0400 Subject: [PATCH 4/5] Update CHANGELOG --- OneSignalExample/Assets/OneSignal/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/OneSignalExample/Assets/OneSignal/CHANGELOG.md b/OneSignalExample/Assets/OneSignal/CHANGELOG.md index 49366b8a3..141a220b3 100644 --- a/OneSignalExample/Assets/OneSignal/CHANGELOG.md +++ b/OneSignalExample/Assets/OneSignal/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sending VSAttribution data from the editor - iOS notifications clicked event firing if the app was cold started from clicking a notification - ClassNotFoundException: com.onesignal.OneSignal for Android builds with minify enabled. You must run the "Copy Android plugin to Assets" step in **Window > OneSignal SDK Setup**. +- Disabled bitcode to avoid iOS build error ## [5.0.2] ### Fixed From 53c7890ee57c31cb58f74490872400faa2aea2c3 Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 3 Oct 2023 20:21:27 -0400 Subject: [PATCH 5/5] 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