有没有一种方法可以确定用户是在使用 Apple Sign In 唱歌还是在唱歌
Is there a way to determine if user is singing in or up using Apple Sign In
当用户使用 Apple Sign In 登录/注册时,有没有办法确定用户是否已经使用 Apple Sign In 注册过一次此应用程序,或者这是他第一次注册
(如果 Apps Using Apple ID 中的应用程序在 iPhone Settings 中列出)?
我想知道是需要在服务器端登录用户还是继续注册流程
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)
被调用。
您可以使用应用委托在应用启动时检查现有的登录详细信息:
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
}
当用户使用 Apple Sign In 登录/注册时,有没有办法确定用户是否已经使用 Apple Sign In 注册过一次此应用程序,或者这是他第一次注册 (如果 Apps Using Apple ID 中的应用程序在 iPhone Settings 中列出)?
我想知道是需要在服务器端登录用户还是继续注册流程
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)
被调用。
您可以使用应用委托在应用启动时检查现有的登录详细信息:
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
}