Amazon web services 调用Amplify.DataStore.save()时,应用程序冻结
我正在使用Kotlin和AWS Amplify制作一个简单的移动应用程序。我将首先展示我的设置。My schema.graphql:Amazon web services 调用Amplify.DataStore.save()时,应用程序冻结,amazon-web-services,kotlin,aws-amplify,Amazon Web Services,Kotlin,Aws Amplify,我正在使用Kotlin和AWS Amplify制作一个简单的移动应用程序。我将首先展示我的设置。My schema.graphql: type OfferGQL @model { id: ID! name: String! description: String! address: String! price: Float! } 我的AWS插件的设置如下: Amplify.addPlugin(AWSCognitoAuthPlugin()) Amplify.a
type OfferGQL @model {
id: ID!
name: String!
description: String!
address: String!
price: Float!
}
我的AWS插件的设置如下:
Amplify.addPlugin(AWSCognitoAuthPlugin())
Amplify.addPlugin(AWSS3StoragePlugin())
Amplify.addPlugin(AWSDataStorePlugin())
Amplify.configure(applicationContext)
以下是我尝试将数据保存到数据存储的方式:
// Create a new offer object
val newOffer = OfferGQL.builder()
.name(textFieldOfferName.text.toString())
.description(textFieldOfferDescription.text.toString())
.address(textFieldOfferAddress.text.toString())
.price(textFieldOfferPrice.text.toString().toFloat())
.build()
// Put it in the DataStore
Amplify.DataStore.save(newOffer,
{result ->
runOnUiThread{Toast.makeText(this,"Offer added successfully", Toast.LENGTH_LONG).show()}
},
{error ->
println(error.message)
println(error.localizedMessage)
println(error.cause)
println(error.recoverySuggestion)
})
问题是,当我调用Amplify.DataStore.save()时,整个应用程序都会冻结。我按照文档对所有内容进行了配置,因此我现在不知道为什么会发生这种情况。在我的手机上完全重新安装应用程序后,该功能最终工作。在我的手机上完全重新安装应用程序后,该功能最终工作。您使用的是哪个版本?我们在1.1.0中遇到了这个特定的问题,您应该能够通过升级到1.1.1来修复它。这两个版本之间的差异就是针对这个问题的修复。为了进行交叉引用,@KapitaiN还在Amplify Android GitHub存储库中为此创建了一个问题:您使用的是哪个版本?我们在1.1.0中遇到了这个特定的问题,您应该能够通过升级到1.1.1来修复它。这两个版本之间的差异就是针对这个问题的修复。为了进行交叉引用,@KapitaiN还在Amplify Android GitHub存储库中为此创建了一个问题,如下所示: