Skip to content

Commit 9c5b08d

Browse files
authored
Merge pull request #645 from OneSignal/fix/iosBitcode
[Fix] iOS bitcode build error
2 parents 425f868 + 2159755 commit 9c5b08d

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

MIGRATION_GUIDE_v3_to_v5.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ The debug namespace is accessible via `OneSignal.Debug` and provides access to d
250250
- We will be introducing JWT in a follow up release
251251

252252
# Troubleshooting
253-
253+
## Android
254254
```
255255
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?)
256256
```
@@ -283,4 +283,13 @@ Execution failed for task ':launcher:mergeReleaseJavaResource'.
283283
1. Go to **Player Settings** and click the Android Tab. Under **Publishing Settings**, enable the following:
284284
- Custom Main Gradle Template
285285
- Custom Gradle Properties Template
286-
2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve**
286+
2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve**
287+
288+
## iOS
289+
**Build error**
290+
```
291+
'/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
292+
```
293+
294+
1. For each target, select the **Build Settings** tab
295+
2. Set **Enable Bitcode** to **No**

OneSignalExample/Assets/OneSignal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Sending VSAttribution data from the editor
1414
- iOS notifications clicked event firing if the app was cold started from clicking a notification
1515
- 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**.
16+
- Disabled bitcode to avoid iOS build error
1617

1718
## [5.0.2]
1819
### Fixed

OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ The debug namespace is accessible via `OneSignal.Debug` and provides access to d
250250
- We will be introducing JWT in a follow up release
251251

252252
# Troubleshooting
253-
253+
## Android
254254
```
255255
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?)
256256
```
@@ -283,4 +283,13 @@ Execution failed for task ':launcher:mergeReleaseJavaResource'.
283283
1. Go to **Player Settings** and click the Android Tab. Under **Publishing Settings**, enable the following:
284284
- Custom Main Gradle Template
285285
- Custom Gradle Properties Template
286-
2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve**
286+
2. Resolve Android dependencies with EDM4U at **Assets > External Dependency Manager > Android Resolver > Force Resolve**
287+
288+
## iOS
289+
**Build error**
290+
```
291+
'/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
292+
```
293+
294+
1. For each target, select the **Build Settings** tab
295+
2. Set **Enable Bitcode** to **No**

OneSignalExample/Assets/OneSignal/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ After building in Unity and exporting the XCode project follow these steps:
119119
120120
6. **App Groups** should now be provisioned for you going forward for your iOS bundle id, even on clean builds.
121121
122+
7. Make sure all **Targets** have **Enable Bitcode** set to **No** in **Build Settings**.
123+
122124
### Android
123125
Most of the Android setup was already handled during installation!
124126

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ After building in Unity and exporting the XCode project follow these steps:
119119
120120
6. **App Groups** should now be provisioned for you going forward for your iOS bundle id, even on clean builds.
121121
122+
7. Make sure all **Targets** have **Enable Bitcode** set to **No** in **Build Settings**.
123+
122124
### Android
123125
In the Unity editor:
124126

com.onesignal.unity.ios/Editor/BuildPostProcessor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public void OnPostprocessBuild(BuildReport report) {
111111
// Add the service extension
112112
AddNotificationServiceExtension();
113113

114+
DisableBitcode();
115+
114116
// Save the project back out
115117
File.WriteAllText(_projectPath, _project.WriteToString());
116118
}
@@ -191,6 +193,7 @@ private void AddNotificationServiceExtension() {
191193
_project.SetBuildProperty(extensionGuid, "SWIFT_VERSION", "5.0");
192194
_project.SetBuildProperty(extensionGuid, "ARCHS", "arm64");
193195
_project.SetBuildProperty(extensionGuid, "DEVELOPMENT_TEAM", PlayerSettings.iOS.appleDeveloperTeamID);
196+
_project.SetBuildProperty(extensionGuid, "ENABLE_BITCODE", "NO");
194197

195198
_project.AddBuildProperty(extensionGuid, "LIBRARY_SEARCH_PATHS",
196199
$"$(PROJECT_DIR)/Libraries/{PluginLibrariesPath.Replace("\\", "/")}");
@@ -282,6 +285,20 @@ private void ExtensionAddPodsToTarget() {
282285

283286
File.WriteAllText(podfilePath, podfile);
284287
}
288+
289+
private void DisableBitcode() {
290+
// Main
291+
var targetGuid = _project.GetMainTargetGuid();
292+
_project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
293+
294+
// Unity Tests
295+
var unityTests = _project.TargetGuidByName(PBXProject.GetUnityTestTargetName());
296+
_project.SetBuildProperty(unityTests, "ENABLE_BITCODE", "NO");
297+
298+
// Unity Framework
299+
var unityFramework = _project.GetUnityFrameworkTargetGuid();
300+
_project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO");
301+
}
285302
}
286303
}
287304
#endif

0 commit comments

Comments
 (0)