From af5fc12d85ff80b763aee38a6859a29276a93411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lupian=CC=83ez=20Casares?= Date: Sun, 3 Nov 2024 17:05:30 +0100 Subject: [PATCH] Updates README and code --- .../Editor/SignInWithApplePostprocessor.cs | 17 ++++--------- README.md | 24 +++++++------------ 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/AppleAuthSampleProject/Assets/AppleAuthSample/Editor/SignInWithApplePostprocessor.cs b/AppleAuthSampleProject/Assets/AppleAuthSample/Editor/SignInWithApplePostprocessor.cs index 6d58f08..b89e4de 100644 --- a/AppleAuthSampleProject/Assets/AppleAuthSample/Editor/SignInWithApplePostprocessor.cs +++ b/AppleAuthSampleProject/Assets/AppleAuthSample/Editor/SignInWithApplePostprocessor.cs @@ -22,18 +22,11 @@ public static void OnPostProcessBuild(BuildTarget target, string path) { #if UNITY_XCODE_EXTENSIONS_AVAILABLE var projectPath = PBXProject.GetPBXProjectPath(path); - - #if UNITY_2019_3_OR_NEWER - var project = new PBXProject(); - project.ReadFromString(System.IO.File.ReadAllText(projectPath)); - var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", null, project.GetUnityMainTargetGuid()); - manager.AddSignInWithAppleWithCompatibility(); - manager.WriteToFile(); - #else - var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", PBXProject.GetUnityTargetName()); - manager.AddSignInWithAppleWithCompatibility(); - manager.WriteToFile(); - #endif + var project = new PBXProject(); + project.ReadFromString(System.IO.File.ReadAllText(projectPath)); + var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", null, project.GetUnityMainTargetGuid()); + manager.AddSignInWithAppleWithCompatibility(); + manager.WriteToFile(); #endif } else if (target == BuildTarget.StandaloneOSX) diff --git a/README.md b/README.md index eb6f48e..cda8f9d 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ There are two options available to install this plugin. Either using the Unity P #### Install via Git URL -Available starting from Unity 2018.3. +Available starting from Unity 2020.3. Just add this line to the `Packages/manifest.json` file of your Unity Project: @@ -144,7 +144,7 @@ This plugin **provides an extension method** for `ProjectCapabilityManager` ([do Simply create a Post Processing build script ([more info](https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html)) that performs the call. If you already have a post process build script, it should be simple to add to your code. -The provided extension method is `AddSignInWithAppleWithCompatibility`. It accepts an optional argument for Unity 2019.3 to indicate the UnityFramework target Guid. +The provided extension method is `AddSignInWithAppleWithCompatibility`. Sample code: ```csharp @@ -159,19 +159,11 @@ public static class SignInWithApplePostprocessor return; var projectPath = PBXProject.GetPBXProjectPath(path); - - // Adds entitlement depending on the Unity version used -#if UNITY_2019_3_OR_NEWER - var project = new PBXProject(); - project.ReadFromString(System.IO.File.ReadAllText(projectPath)); - var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", null, project.GetUnityMainTargetGuid()); - manager.AddSignInWithAppleWithCompatibility(project.GetUnityFrameworkTargetGuid()); - manager.WriteToFile(); -#else - var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", PBXProject.GetUnityTargetName()); - manager.AddSignInWithAppleWithCompatibility(); - manager.WriteToFile(); -#endif + var project = new PBXProject(); + project.ReadFromString(System.IO.File.ReadAllText(projectPath)); + var manager = new ProjectCapabilityManager(projectPath, "Entitlements.entitlements", null, project.GetUnityMainTargetGuid()); + manager.AddSignInWithAppleWithCompatibility(); + manager.WriteToFile(); } } ``` @@ -214,7 +206,7 @@ There is also a [Getting Started site](https://developer.apple.com/sign-in-with- The `AuthenticationServices.framework` should be added as Optional, to support previous iOS versions, avoiding crashes at startup. -The provided extension method uses reflection to integrate with the current tools Unity provides. It has been tested with Unity 2018.x and 2019.x. But if it fails on your particular Unity version, feel free to open a issue, specifying the Unity version. +The provided extension method uses reflection to integrate with the current tools Unity provides. It has been tested with Unity 2020.x, 2021.x, 2022.x and 6000.0. But if it fails on your particular Unity version, feel free to open a issue, specifying the Unity version. ## Plugin setup (visionOS)