Apple文檔——通過 Apple 登錄
使用入門 - 通過 Apple 登錄 - Apple Developer
Apple文檔——設計要求——登錄通過 Apple 登錄 | Apple Developer Documentation
插件github版——apple-signin-unity(README 中為接入步驟)
GitHub - lupidan/apple-signin-unity: Unity plugin to support Sign In With Apple Id
Unity Blog——Support for Apple sign in(注意其中assetstore鏈接已失效)
https://blog.unity.com/engine-platform/support-for-apple-sign-in
或使用Unity AssetStore 版——Sign in with Apple Plugin for Unity
Sign in with Apple Plugin for Unity | Integration | Unity Asset Store
Apple文檔開發者賬戶幫助(后臺管理)(管理賬號/團隊/證書/密鑰、配置服務/功能等)
賬戶 - 幫助 - Apple Developer
按照 github ReadMe 接入:
1、按Unity Package Manager?的導入方式。導入 v1.4.3版。
2、完成插件設置(ios)(使用腳本進行設置)
在Unity Assets/Editor/AppleAuth 中創建 SignInWithApplePostprocessor.cs
(注意全部包入 #if UNITY_IOS?中)
3、初始化
4、按照流程圖寫登錄邏輯。
流程大意:
⑴、有歷史UserId時,先 GetCredentialState?判斷狀態,若已登錄則完整;若未登錄則 DoLoginWithAppleId。?
⑵、無歷史UserId時,先DoQuickLogin,若失敗則 DoLoginWithAppleId。
⑶、若 DoLoginWithAppleId?失敗,將提示錯誤,并返回至“選擇登錄方式”狀態。
打包報錯:
/Users/nratel/.jenkins/workspace/BuildTestApp_iOS/NativeProject/XXX/Unity-iPhone.xcodeproj: error: Provisioning profile "DevXXX20240606" doesn't support the Sign in with Apple capability. (in target 'Unity-iPhone' from project 'Unity-iPhone')
/Users/nratel/.jenkins/workspace/BuildTestApp_iOS/NativeProject/XXX/Unity-iPhone.xcodeproj: error: Provisioning profile "DevXXX20240606" doesn't include the com.apple.developer.applesignin entitlement. Profile qualification is using entitlement definitions that may be out of date. Connect to network to update. (in target 'Unity-iPhone' from project 'Unity-iPhone')
原因:證書不支持。
解決:找運營更換證書。