当前位置: 首页 > 知识库问答 >
问题:

AWS功放: AWSCognitoAuthPlugin无法解码配置

岑俊明
2023-03-14

请对我温柔点。我不熟悉斯威夫特和AWS。我试图使用AWS身份验证进行用户登录。使用AWSCognitoAuthPlugin,我得到这个错误:

An error occurred setting up Amplify: PluginError: Unable to decode configuration
Recovery suggestion: Make sure the plugin configuration is JSONValue

我在Swift文件中的内容非常通用,遵循AWS指南进行设置。到目前为止,我还没有登录的用户界面。我通过日志看到错误。

这是我的密码:

import SwiftUI
import Amplify
import AWSAPIPlugin
import AWSDataStorePlugin
import AWSCognitoAuthPlugin


class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        do {
            Amplify.Logging.logLevel = .verbose
            try Amplify.add(plugin: AWSCognitoAuthPlugin())
            try Amplify.configure()
            print("Amplify configured with auth plugin")
        } catch {
            print("An error occurred setting up Amplify: \(error)")
        }
        return true
    }
}

@main
struct MyAmplifyAppApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}


我没有使用可可豆,因为这会导致amplify的import语句不起作用。我遵循AWS的指南:https://docs.amplify.aws/lib/auth/getting-started/q/platform/ios#install-扩充图书馆

卡在初始化放大验证部分的最后一步。

共有1个答案

叶书
2023-03-14

几天来,我也面临着同样的错误,你刚刚向项目添加了基本文件,现在你需要为放大器定义用户池,以便向两个配置文件添加更多数据。您需要运行这些命令,它将解决此问题。请确保您在项目目录中。

amplify init // It will make sure you have basic setup added
amplify add auth // It will add auth data and user pools to config files
amplify push // It will push all the setup to amplify cloud

希望它能解决这个问题:)

 类似资料:
  • 在github页面上https://github.com/aws-amplify/aws-sdk-android 它说: 对于新项目,我们建议使用Amplify框架与AWS交互。 关于JS开发的放大框架页面(https://docs.amplify.aws/lib/q/platform/js),有一个名为PubSub的库,它应该执行MQTT连接。 但是如果我转向Android开发(https://

  • 我有一个将文件上载到aws S3的应用程序,从我的本地工作正常,但当我将应用程序上载到Elastic Beanstalk并尝试上载文件时,应用程序失败,并返回一个文本413请求实体过大的错误。我的应用程序使用Spring Boot和Spring cloud,我的应用程序属性为: 有人知道这个问题吗?

  • 试图将HEVC编码的视频多路复用到三星Galaxy S6上的MediaMuxer MPEG-4容器中。 MediaFormat(从MediaCodec获得): 根据文档中的表格,csd-0出现在那里,对于H265/hevc来说就足够了 MediaMuxer基于此格式创建索引为0的视频曲目。在编写一些示例,然后调用mediaMuxer之后。stop(),,并在logcat中显示以下内容: 生成的MP

  • 问题内容: 嘿,我不确定为什么每次选择图库中的图像时都会出现这种情况吗? 这是代码: 错误: 问题答案: 不要假设有文件路径。Android 4.4及更高版本即将删除它们。而且您获得的uri已经没有路径。 您仍然可以通过()或文件描述符访问文件内容。 在这里进行了解释:ContentProviders:打开一个文档(向下滚动,指向该节的链接似乎已损坏) 而且确实适用于较旧的android版本。

  • 当应用程序在AWS Elasticbeanstrok上运行时,有人知道如何从资源文件夹中读取文件吗? 请参阅下面的代码: 这是错误消息: JAVA木卫一。FileNotFoundException:类路径资源[application.properties]无法解析为绝对文件路径,因为它不位于文件系统:jar:file:/var/app/current/application中。罐子/BOOT-IN