I have been Googling for hours and trying every variation of this code that I can think of but I haven't been able to get the Sign In With Apple capability to be added automatically.
I have tried examples from this Github project: https://github.com/lupidan/apple-signin-unity/blob/master/AppleAuth/Editor/ProjectCapabilityManagerExtension.cs
I have been following these posts: https://forum.unity.com/threads/how-to-put-ios-entitlements-file-in-a-unity-project.442277/
https://answers.unity.com/questions/1224123/enable-push-notification-in-xcode-project-by-defau.html
An entitlements file without this capability looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
And one with the capability looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>
I have tried to guestimate with this code:
proj.AddBuildProperty(target, "SystemCapabilities", "{com.apple.developer.applesignin = [Default];}");
proj.AddCapability(target, PBXCapabilityType.SignInWithApple, relativeDestination, true);
But none of these modify the entitlements file or add the capability.
I treid using the ProjectCapabilityManager with this:
ProjectCapabilityManager capabilityManager = new ProjectCapabilityManager(buildPath, filename, targetName);
capabilityManager.AddSignInWithApple();
capabilityManager.WriteToFile();
But I get an error message in the console saying that access was denied to the buildPath (which was provided by OnPostProcessBuild())
I could really use some help.
I'm on Unity3D 5.6.7f and this is what I did to make it work:
Download XcodeAPI from Unity's official bitbucket repositry
Open CapabilityManager.cs and add the following code
and this
Now you can add Sign In With Apple capability with a post-process like this