當用戶使用 Apple Sign In 登錄/注冊時,有沒有辦法確定用戶是否已經使用 Apple Sign In 注冊過此應用程式,還是他第一次注冊(如果應用程式中的應用程式在 iPhone 中使用 Apple ID串列)設定)?

我想知道是需要在服務端登錄用戶還是之后繼續登錄流程
func 授權控制器(控制器:ASAuthorizationController,didCompleteWithAuthorization 授權:ASAuthorization)
叫做。
uj5u.com熱心網友回復:
您可以使用應用程式委托檢查應用程式啟動時的現有登錄詳細資訊:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let appleIDProvider = ASAuthorizationAppleIDProvider()
appleIDProvider.getCredentialState(forUserID: KeychainItem.currentUserIdentifier) { (credentialState, error) in
switch credentialState {
case .authorized:
break // The Apple ID credential is valid.
case .revoked, .notFound:
// The Apple ID credential is either revoked or was not found, so show the sign-in UI.
DispatchQueue.main.async {
self.window?.rootViewController?.showLoginViewController()
}
default:
break
}
}
return true
}
來源:https : //developer.apple.com/documentation/sign_in_with_apple/implementing_user_authentication_with_sign_in_with_apple
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/394792.html
