Search code examples
iosswiftamazon-web-servicesaws-sdkaws-mobilehub

AWS Auth UI Login - Keyboard Bug


In the AWS Auth UI, when I click on username textfield it moves the field out of view. This happens on both Plus and regular sized devices. I am using XCode 9.3 and Swift 4.1.

This is my code below calling the AWSAuthUIViewController.

    if !AWSSignInManager.sharedInstance().isLoggedIn {
        let config = AWSAuthUIConfiguration()
        config.enableUserPoolsUI = true
        config.backgroundColor = .black
        config.isBackgroundColorFullScreen = true
        config.logoImage = #imageLiteral(resourceName: "LogoBlack")
        config.canCancel = true

        AWSAuthUIViewController.presentViewController(with: self.navigationController!,
                                                      configuration: config,
                                                      completionHandler: { (provider: AWSSignInProvider, error: Error?) in
                                                        if error != nil {
                                                            print("Error occurred: \(error)")
                                                        } else {
                                                            self.onSignIn()
                                                        }
        })

You can view the image of the bug at https://i.sstatic.net/CVrkL.jpg - iPhone 8 Plus simulator.


Solution

  • It looks like this problem crept in with the latest versions of the AWS iOS Swift pods. If you take a look at the diff of AWSSignInViewController.m from 2.6.13 to 2.6.14 here, you'll see that there have been additions to the code for handling the hide/show events of the software keyboard.

    TL;DR Just specify version 2.6.13 for all of your AWS pods until Amazon sorts out their UI issues in a later release, like so:

    pod 'AWSAuthCore', '2.6.13'
    pod 'AWSUserPoolsSignIn', '2.6.13'
    pod 'AWSAuthUI', '2.6.13'
    pod 'AWSPinpoint', '2.6.13'
    pod 'AWSCognito', '2.6.13'
    pod 'AWSAPIGateway', '2.6.13'
    pod 'AWSCognitoIdentityProvider', '2.6.13'
    pod 'AWSS3', '2.6.13'
    ...
    

    Edit: This has been verified to be resolved in 2.6.17