Ios iPad中谷歌登录用户代理问题
我正在我的应用程序中使用谷歌登录。我已经使用链接中给出的步骤通过firebase进行了配置。我的问题是,当我在iPhone上打开我的应用程序时,它会重定向到移动浏览器,并且工作绝对正常。但当我在iPad上打开应用程序时,它会在网络视图中打开,因此出现了用户代理问题 有人可以建议我如何强制应用程序进入浏览器,即使它是在iPad上打开的 我已附上我的代码以供参考Ios iPad中谷歌登录用户代理问题,ios,swift,ipad,google-signin,Ios,Swift,Ipad,Google Signin,我正在我的应用程序中使用谷歌登录。我已经使用链接中给出的步骤通过firebase进行了配置。我的问题是,当我在iPhone上打开我的应用程序时,它会重定向到移动浏览器,并且工作绝对正常。但当我在iPad上打开应用程序时,它会在网络视图中打开,因此出现了用户代理问题 有人可以建议我如何强制应用程序进入浏览器,即使它是在iPad上打开的 我已附上我的代码以供参考 @available(iOS 9.0, *) func application(_ application: UIApplicatio
@available(iOS 9.0, *)
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any])
-> Bool
{
return GIDSignIn.sharedInstance().handle(url,
sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
annotation: [:])
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
{
return GIDSignIn.sharedInstance().handle(url,
sourceApplication: sourceApplication,
annotation: annotation)
}
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?)
{
if error != nil {
// ...
print(error!)
return
}
guard let authentication = user.authentication else { return }
let credential = FIRGoogleAuthProvider.credential(withIDToken: authentication.idToken,
accessToken: authentication.accessToken)
FIRAuth.auth()?.signIn(with: credential) { (user, error) in
print(user!)
GIDSignIn.sharedInstance().signOut()
self.view.hideToastActivity()
self.getUserDetails(email: (user?.email)!)
if error != nil {
// ...
print(error!)
return
}
}
}
func sign(_ signIn: GIDSignIn!, didDisconnectWith user:GIDGoogleUser!,
withError error: Error!) {
// Perform any operations when the user disconnects from app here.
// ...
if error != nil {
// ...
print(error)
return
}
}
如果您使用的是GTM-OAuth2库,google曾提到它不赞成使用GTM-OAuth2库所依赖的web视图。他们建议改用图书馆 如果您使用的是GTM-OAuth2库,google曾提到,它不赞成使用GTM-OAuth2库所依赖的web视图。他们建议改用图书馆 您是否实现了当您单击“登录”按钮时调用的func signIn(signIn:GIDSignIn!,presentViewController viewController:UIViewController!){self.presentViewController(viewController,动画:true,完成:nil)}方法?是否实现了此方法func signIn(signIn:GIDSignIn!,presentViewController viewController:UIViewController!){self.presentViewController(viewController,动画:true,完成:nil)}在您单击登录按钮时调用的?