【发布时间】:2020-10-05 16:32:27
【问题描述】:
我正在使用 AWS amplify 构建我的 ios 应用程序的后端。我在初始化 appsync 客户端时遇到问题。我已将 Auth 添加到后端并已登录,但我在控制台中收到以下错误:
控制台:
Error initializing appsync client. invalidAuthConfiguration("AWSCognitoUserPoolsAuthProvider cannot be nil.")
在 AppDelegate 中:
// CONFIGURE AWSAppSync
do {
// You can choose your database location if you wish, or use the default
let cacheConfiguration = try AWSAppSyncCacheConfiguration()
// AppSync configuration & client initialization
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig(), cacheConfiguration: cacheConfiguration)
appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig)
print("appSyncClient initialise success \n")
} catch {
print("Error initializing appsync client. \(error)")
}
我只是在这里猜测,但“appSyncConfig”变量应该是:
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig.init(), cacheConfiguration: cacheConfiguration, userPoolsAuthProvider: AWSCognitoUserPoolsAuthProvider?)
但是我如何获得 AWSCognitoUserPoolsAuthProvider????
【问题讨论】:
标签: swift aws-amplify aws-appsync