Google 和 Facebook 登录控制器在 Xcode 11 iOS 13 中以模态方式呈现
Posted
技术标签:
【中文标题】Google 和 Facebook 登录控制器在 Xcode 11 iOS 13 中以模态方式呈现【英文标题】:Google & Facebook Login Controllers presenting modally in Xcode 11 iOS 13 【发布时间】:2019-10-30 12:55:29 【问题描述】:我已将 pod 更新到最新版本,并且
重写方法
override func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil)
viewControllerToPresent.modalPresentationStyle = .fullScreen
super.present(viewControllerToPresent, animated: flag, completion: completion)
所有其他控制器都显示为全屏,但 Google 和 Facebook 登录仍显示为页面表。
如何像之前一样全屏显示它们?
提前致谢!
更新
我找到了解决方法。如果我将我的 LoginViewController 设置为窗口的 rootViewController,那么它们会呈现全屏,但如果我从 UINavigationController 呈现它们,它们就会呈现模态。
func showSignUpScreen()
let controller:SignUpViewController = UIStoryboard.instantiateViewController(storyboardName: .loginSignup, viewControllerIdetifier: "SignUpViewController")
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
//Presents full Screen
UIApplication.shared.delegate?.window??.rootViewController = controller
//Presents Modally
self.navigationController?.pushViewController(controller, animated: false)
但我不能总是显示标签栏在窗口上显示时会隐藏。我需要标签栏来显示其他不需要登录的屏幕。
【问题讨论】:
【参考方案1】:以下扩展以全屏模式显示 Safari 视图
import SafariServices
extension SFSafariViewController
override open var modalPresentationStyle: UIModalPresentationStyle
get return .fullScreen
set super.modalPresentationStyle = newValue
【讨论】:
以上是关于Google 和 Facebook 登录控制器在 Xcode 11 iOS 13 中以模态方式呈现的主要内容,如果未能解决你的问题,请参考以下文章
为啥在 google play store 上发布后 google 和 facebook 登录不起作用
Facebook 和 Google 登录 - 冲突 (Xcode)
将 facebook 和 google 集成在同一个应用程序中,并允许用户同时登录