问题描述
我有一个 UIAlert,用于将用户重定向到 Gmail Firebase 登录。现在我想添加对使用 Apple 登录的支持。但是我在多个位置读到您必须设置按钮 this way:
let siwaButton = ASAuthorizationAppleIDButton()
siwaButton.addTarget(self,action: #selector(appleSignInTapped),for: .touchUpInside)
@objc func appleSignInTapped() {
let provider = ASAuthorizationAppleIDProvider()
let request = provider.createRequest()
// request full name and email from the user's Apple ID
request.requestedScopes = [.fullName,.email]
// pass the request to the initializer of the controller
let authController = ASAuthorizationController(authorizationRequests: [request])
// similar to delegate,this will ask the view controller
// which window to present the ASAuthorizationController
authController.presentationContextProvider = self
// delegate functions will be called when user data is
// successfully retrieved or error occured
authController.delegate = self
// show the Sign-in with Apple dialog
authController.performRequests()
}
是否可以将此按钮添加到以下 UIAlertView 中?如果没有,是否有一个 pod 可以轻松显示标志选项菜单?
let preSignInAlert = UIAlertController(title: "Discussions",message: preLoginInfoMessage,preferredStyle: .alert)
let dismissAction = UIAlertAction(title: "Okay",style: .cancel) { _ in }
let loginAction = UIAlertAction(title: "Login",style: .default) { (alert) in
GIDSignIn.sharedInstance()?.signIn()
}
// Space for a third Apple Login button
preSignInAlert.addAction(dismissAction)
preSignInAlert.addAction(loginAction)
present(preSignInAlert,animated: true,completion: nil)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)