GIDSignIn white screen on iOS 9

℡╲_俬逩灬. 提交于 2019-12-01 04:36:29

So, I had exactly the same issue as you. It spent me hrs to try out everything. I finally found a solution, which might not be 100% correct, but it works for me and fixed the problem.

This is what I did in my project. First, I implemented the three GIDSignInUIDelegate functions myself, which is conflict to the official document because my GIDSignInUIDelegate is subclass to the UIViewController. But I am using my custom signing button, and it didn't work when I followed the google official document. So I tried out everything and found it works.

After you implemented the delegate function, there are two major things need to do.

  1. In the following function, set viewController.view.layoutIfNeeded()

     func sign(_ signIn: GIDSignIn!, present viewController: UIViewController!) {
         //This line does the trick to fix signin web not showing issue
         viewController.view.layoutIfNeeded()
    
         self.present(viewController, animated: true, completion: nil)
      }
    
  2. Don't set up this delegate in the ViewDidLoad()

    GIDSignIn.sharedInstance().uiDelegate = self
    

Instead, set them up in the button action. Otherwise, it somehow keeps showing delegate

Hope it will help your problem.

I am also facing same issue. In fact in one Viewcontroller it is working for me and another viewcontroller it is not working.

It works for me if I call [[GIDSignIn sharedInstance] signIn] inside some Button Action method and not in. But if I call it inside viewDidLoad I get white screen.

I found another workaround but I am not going by this as I think it is not reliable

[self performSelector:@selector(LogActionPresed:) withObject:self afterDelay:3.5];

Where LogActionPresed is method which internally calls [[GIDSignIn sharedInstance] signIn]

Another Working Solution is to call this method inside viewDidAppear

- (void) viewDidAppear:(BOOL)animated {
    [self LogActionPresed:self];
}

On iOS 10, I'm observing that it works if the presenting view controller is in the stack of a UINavigationController. The web view remains empty and white if the presenting view controller is not in such a stack.

After removing Activity Indicator, worked for me.

Google Pod remembers the user you logged in to. Try to do logout on error and on exit. This will allow you to choose your account in Google the next time you log in.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!