放大iOS登录屏幕未呈现控件

时间:2018-11-05 17:33:42

标签: ios aws-amplify

我正在与iOS上的AWS Amplify一起使用现成的用户身份验证屏幕,但不幸的是,它们并未完全呈现,如下所示。我正在使用https://docs.aws.amazon.com/aws-mobile/latest/developerguide/add-aws-mobile-user-sign-in.html上的Amplify教程中的代码。我正在使用XCode 10,并且在iOS的v12和v11.4上尝试了许多设备模拟器,并且它们都表现出相同的行为。其他人遇到过这种情况吗?我的代码如下:

Podfile

platform :ios, '12.0'

target 'TestApp1' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestApp1
  pod 'AWSCore', '~> 2.6.33'
  pod 'AWSPinpoint', '~> 2.6.33'
  pod 'AWSMobileClient', '~> 2.6.33'
  pod 'AWSUserPoolsSignIn', '~> 2.6.33'
  pod 'AWSAuthUI', '~> 2.6.33'

end

AppDelegate.swift

import AWSPinpoint
import AWSMobileClient

...

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Create AWSMobileClient to connect with AWS
        return AWSMobileClient.sharedInstance().interceptApplication(application, didFinishLaunchingWithOptions: launchOptions)
    }

    func application(_ application: UIApplication, open url: URL,
                     sourceApplication: String?, annotation: Any) -> Bool {

        return AWSMobileClient.sharedInstance().interceptApplication(
            application, open: url,
            sourceApplication: sourceApplication,
            annotation: annotation)

    }

从尝试启动登录屏幕的位置查看代码

import AWSCore
import AWSMobileClient
import AWSAuthCore
import AWSAuthUI

...

override func viewDidLoad() {
    super.viewDidLoad()
    showSignIn()
}

func showSignIn() {
    if !AWSSignInManager.sharedInstance().isLoggedIn {
        AWSAuthUIViewController
            .presentViewController(with: self.navigationController!,
                                   configuration: nil,
                                   completionHandler: { (provider: AWSSignInProvider, error: Error?) in
                                    if error != nil {
                                        print("Error occurred: \(String(describing: error))")
                                    } else {
                                        print("Identity provider: \(provider.identityProviderName)")
                                    }
            })
    }
}

Screen Print of Emulator

1 个答案:

答案 0 :(得分:1)

这个名叫rohandubal的绅士在GitHub的https://github.com/aws/aws-sdk-ios/issues/1082上为我回答了这个问题。问题是我的awsconfiguration.json文件没有CognitoUserPool的配置信息。

相关问题