放大 iOS 登录屏幕不呈现控件
Amplify iOS Login Screen Not Rendering Controls
我正在 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 上尝试过许多设备模拟器,它们都表现出相同的行为。有没有其他人经历过这种情况?我的代码包含在下面:
播客文件
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 上与 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 上尝试过许多设备模拟器,它们都表现出相同的行为。有没有其他人经历过这种情况?我的代码包含在下面:
播客文件
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 的配置信息。