0

I have implemented code as per the google SDK documentation line by line in my app, but still when I click on google sign in button app shifts to new view controller with webview with blank screen. Have tried multiple solution found here : GIDSignIn white screen on iOS 91. But no lucks with resolving the problem , have attached the screen shot for getting closer look about the screen. Blank Screen after clicking on Google Sign In button

Following are the pods that I'm using,

Pod List

Running XCode 9.1, iOS 10.0 and later. Kindly request someone to help.

Update: View Hierarchy enter image description here

Update: viewDidLoad's code:

 GIDSignIn.sharedInstance().uiDelegate = self
    if self.isChangePassword {
        self.addSignInView()
    }
    else {
        self.addSignUpView()
    }

fileprivate func addSignInView() {
    guard let signInEmailView: SignInEmailView = Bundle.main.loadNibNamed(NibNames.SignInEmailView.rawValue, owner: self, options: nil)?[0] as? SignInEmailView
        else {
            return
    }
    signInEmailView.delegate = self
    gaManager.trackScreen(screenName: ScreenNames.SignIn.rawValue)
    self.animateView(signInEmailView)

}

fileprivate func addSignInView() {
    guard let signInEmailView: SignInEmailView = Bundle.main.loadNibNamed(NibNames.SignInEmailView.rawValue, owner: self, options: nil)?[0] as? SignInEmailView
        else {
            return
    }
    signInEmailView.delegate = self
    gaManager.trackScreen(screenName: ScreenNames.SignIn.rawValue)
    self.animateView(signInEmailView)

}
Fatin Wasta
  • 424
  • 1
  • 6
  • 20

2 Answers2

0

I have the same problem. I use the UIAlertView to confirm user really want to do authorization. It will show the blank screen. If I remove the UIAlertView and show the authorization view directly. It works fine. The problem also show in the Dropbox authorization screen. If you not use UIAlertView , please try to pass the top most controller

https://github.com/dropbox/dropbox-sdk-obj-c/issues/182

Hope this can do some help.

Ted Yu
  • 304
  • 3
  • 13
  • Hey, thank you for replying and the reference link. I tried showing UIAlertView for authorization but still problem persist. Also can you please elaborate about "please try to pass the top most controller" , or some code to help me through. – Fatin Wasta Dec 16 '17 at 07:12
  • When you do the SignIn action. The presenting view controller must be in the stack of a UINavigationController. https://stackoverflow.com/a/45813089/871221 – Ted Yu Dec 19 '17 at 05:52
  • It's already in UINavigationController stack, But still going through same result. Also tried pushing the VC as: func sign(_ signIn: GIDSignIn!, present viewController: UIViewController!) { print("sign: present") viewController.view.layoutIfNeeded() self.navigationController?.pushViewController(viewController, animated: true) // present(viewController, animated: true, completion: nil) } Still same result. – Fatin Wasta Dec 23 '17 at 10:33
  • also check my pods I'm using, have updated my question. Another doubt I'm having is, is this because of pods version? cause I've just created demo project and implemented same code, only difference was the pods were updated and it ran successfully. – Fatin Wasta Dec 23 '17 at 10:59
  • Hi if you follow the https://www.simplifiedios.net/google-sign-integration-ios/ step by step to the new project. Would you show the blank screen still? – Ted Yu Dec 26 '17 at 01:34
  • Hey, tried above link, it worked like charm in demo project , didn't had single issue. And after that, I commented each and every single line in my project and copy pasted the code from demo project. Still no luck with my project. – Fatin Wasta Dec 26 '17 at 07:05
  • Hey found out the problem, you were right, about VC being in the UINavigationStack. So problem is my VC is the first VC in which I want to add an Google Sign In. And I'm using two nibs in one VC for switching to signup and sign-in custom views in UI. So first time when App runs GSignIn does not work. But when I login with my normal email and I get navigated to home screen. So Now if I logged out and try GSignIn it works fine. This is the only problem. I checked it thrice and came through same result. Would you suggest anything how I can overcome this one? – Fatin Wasta Dec 26 '17 at 12:45
  • Hi , Every time launch the app should go to the home VC first. If you want to show sign in screen automatically. You can write Google Sign In code in the Viewdidload() function like this [ if( not sign in ) showGoogleSignIn(); ] – Ted Yu Dec 27 '17 at 09:33
  • Hey, My Sign-In VC is already the first VC in my UINavigation Stack. Do you want me to remove UINavigationController? Please refer my update in question. I've uploaded an pic for view hierarchy. – Fatin Wasta Dec 28 '17 at 04:40
  • Hi, you should show your first VC(Sign View Controller) code to let us know what you did in it. – Ted Yu Dec 30 '17 at 02:28
0

Finally after so many days found the problem. I was showing splash view from my appDelegate using refrence of UIWindow which was adding and removing an imgview as subview to the window. So it was somehow messing with the UINavigation's stack and my view controller was not getting any reference to the UINavigationController. After removing that code it's working just fine. Also came to the solution that, if I want to show splash screen, as I can't use UIWindow's reference, I have to add new VC and write my all navigation code there. @TedYu Thank you very much for the help. :)

Fatin Wasta
  • 424
  • 1
  • 6
  • 20