Skip to content

Commit a8f9ec1

Browse files
committed
iOS fix
1 parent 6394733 commit a8f9ec1

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎testproject/Assets/Editor.meta‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#if UNITY_IOS
2+
using UnityEditor;
3+
using UnityEditor.Callbacks;
4+
using UnityEditor.iOS.Xcode;
5+
6+
public static class IOSLinkerPostProcessor
7+
{
8+
[PostProcessBuild(1000)]
9+
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
10+
{
11+
if (target != BuildTarget.iOS)
12+
{
13+
return;
14+
}
15+
16+
var projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
17+
var project = new PBXProject();
18+
project.ReadFromFile(projectPath);
19+
20+
// Xcode 15's default linker cannot reach objc_msgSend selector stubs across the >128MB
21+
// IL2CPP Debug test binary; the classic linker inserts branch islands to keep the ARM64
22+
// B/BL calls in range.
23+
foreach (var guid in new[] { project.GetUnityMainTargetGuid(), project.GetUnityFrameworkTargetGuid() })
24+
{
25+
project.AddBuildProperty(guid, "OTHER_LDFLAGS", "-Wl,-ld_classic");
26+
}
27+
28+
project.WriteToFile(projectPath);
29+
}
30+
}
31+
#endif

‎testproject/Assets/Editor/IOSLinkerPostProcessor.cs.meta‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)