我正在 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)")
}
})
}
}
最佳答案
这个问题在 GitHub 上得到了回答 https://github.com/aws/aws-sdk-ios/issues/1082一位名叫 rohandubal 的绅士。问题是我的 awsconfiguration.json 文件没有 CognitoUserPool 的配置信息。
关于ios - 放大 iOS 登录屏幕不呈现控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53159392/