You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
#if UNITY_IOS && UNITY_EDITOR
|
|
using UnityEditor;
|
|
using UnityEditor.Callbacks;
|
|
using UnityEditor.iOS.Xcode;
|
|
using UnityEngine;
|
|
using System.IO;
|
|
|
|
public class GoogleSignInIOSBuildPatch
|
|
{
|
|
[PostProcessBuild(100)]
|
|
public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuiltProject)
|
|
{
|
|
if (buildTarget != BuildTarget.iOS)
|
|
return;
|
|
|
|
string plistPath = Path.Combine(pathToBuiltProject, "Info.plist");
|
|
|
|
// === Modify Info.plist ===
|
|
PlistDocument plist = new PlistDocument();
|
|
plist.ReadFromFile(plistPath);
|
|
PlistElementDict rootDict = plist.root;
|
|
|
|
// Optional: can be removed if not used by your native code
|
|
rootDict.SetString("GIDClientID", GameConstants.iOS_ClientID);
|
|
|
|
PlistElementArray urlTypes = rootDict.CreateArray("CFBundleURLTypes");
|
|
PlistElementDict urlDict = urlTypes.AddDict();
|
|
PlistElementArray schemes = urlDict.CreateArray("CFBundleURLSchemes");
|
|
schemes.AddString(GameConstants.iOS_URL_Scheme);
|
|
|
|
plist.WriteToFile(plistPath);
|
|
Debug.Log("✅ Patched Info.plist with URL scheme.");
|
|
|
|
// DO NOT PATCH UnityAppController.mm — GIDSignIn.clientID is removed in SDK v6+
|
|
}
|
|
}
|
|
#endif |