Skip to content

Commit

Permalink
Updates README and code
Browse files Browse the repository at this point in the history
  • Loading branch information
lupidan committed Nov 3, 2024
1 parent f6ed445 commit af5fc12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand All @@ -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();
}
}
```
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit af5fc12

Please sign in to comment.