Skip to content

Commit b2bf028

Browse files
committed
fix: add GCC_ENABLE_OBJC_EXCEPTIONS to UnityFramework target if present
1 parent 6c1b79e commit b2bf028

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Assets/Adjust/Editor/AdjustEditor.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,13 @@ private static void RunPostBuildScript(BuildTarget target, string projectPath =
179179
Debug.Log("[Adjust]: Skipping AppTrackingTransparency.framework linking.");
180180
}
181181

182-
// The Adjust SDK needs to have Obj-C exceptions enabled.
183-
// GCC_ENABLE_OBJC_EXCEPTIONS=YES
184-
Debug.Log("[Adjust]: Enabling Obj-C exceptions by setting GCC_ENABLE_OBJC_EXCEPTIONS value to YES.");
185-
xcodeProject.AddBuildProperty(xcodeTarget, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
186-
Debug.Log("[Adjust]: Obj-C exceptions enabled successfully.");
187-
188182
// The Adjust SDK needs to have -ObjC flag set in other linker flags section because of it's categories.
189183
// OTHER_LDFLAGS -ObjC
190184
//
191185
// Seems that in newer Unity IDE versions adding -ObjC flag to Unity-iPhone target doesn't do the trick.
192186
// Adding -ObjC to UnityFramework target however does make things work nicely again.
193187
// This happens because Unity is linking SDK's static library into UnityFramework target.
194188
// Check for presence of UnityFramework target and if there, include -ObjC flag inside of it.
195-
196189
Debug.Log("[Adjust]: Adding -ObjC flag to other linker flags (OTHER_LDFLAGS) of Unity-iPhone target.");
197190
xcodeProject.AddBuildProperty(xcodeTarget, "OTHER_LDFLAGS", "-ObjC");
198191
Debug.Log("[Adjust]: -ObjC successfully added to other linker flags.");
@@ -204,6 +197,18 @@ private static void RunPostBuildScript(BuildTarget target, string projectPath =
204197
Debug.Log("[Adjust]: -ObjC successfully added to other linker flags.");
205198
}
206199

200+
// The Adjust SDK needs to have Obj-C exceptions enabled.
201+
// GCC_ENABLE_OBJC_EXCEPTIONS=YES
202+
Debug.Log("[Adjust]: Enabling Obj-C exceptions by setting GCC_ENABLE_OBJC_EXCEPTIONS value to YES.");
203+
xcodeProject.AddBuildProperty(xcodeTarget, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
204+
Debug.Log("[Adjust]: Obj-C exceptions enabled successfully.");
205+
if (!string.IsNullOrEmpty(xcodeTargetUnityFramework))
206+
{
207+
Debug.Log("[Adjust]: Enabling Obj-C exceptions by setting GCC_ENABLE_OBJC_EXCEPTIONS value to YES.");
208+
xcodeProject.AddBuildProperty(xcodeTargetUnityFramework, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
209+
Debug.Log("[Adjust]: Obj-C exceptions enabled successfully.");
210+
}
211+
207212
if (xcodeProject.ContainsFileByProjectPath("Libraries/Adjust/iOS/AdjustSigSdk.a"))
208213
{
209214
if (!string.IsNullOrEmpty(xcodeTargetUnityFramework))

0 commit comments

Comments
 (0)