gpt4 book ai didi

ios - 如何在 Swift 中从 AWS Mobile Hub 检索电子邮件和电话号码?

转载 作者:行者123 更新时间:2023-11-30 11:54:13 25 4
gpt4 key购买 nike

有谁知道如何在 Swift 中从 AWS Mobile Hub 检索电子邮件和电话号码(如下图所示)?

Picture

我只知道如何使用以下代码检索用户名:

  let serviceConfiguration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:nil)
let configuration = AWSCognitoIdentityUserPoolConfiguration(clientId: "clientId", clientSecret: "clientSecret", poolId: "poodId")
AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: configuration, forKey: "Users")
let pool = AWSCognitoIdentityUserPool(forKey: "Users")
print(pool.currentUser()?.username)

如有任何建议,我们将不胜感激。

最佳答案

正确的做法是:

@objc func retrieveFromAttributes() {

let dynamoDbObjectMapper = AWSDynamoDBObjectMapper.default()
let newProfileAttributes: ProfileAttributes = ProfileAttributes()
newProfileAttributes._userId = AWSIdentityManager.default().identityId
dynamoDbObjectMapper.load(ProfileAttributes.self, hashKey: newProfileAttributes._userId, rangeKey: "Vincent Sun", completionHandler: { (objectModel: AWSDynamoDBObjectModel?, error: Error?) -> Void in
if let error = error {
print("Amazon DynamoDB Read Error: \(error)")
return
}
print("An item was read.")

DispatchQueue.main.async {
self.nameTextField.text = objectModel?.dictionaryValue["_nickname"] as? String
}


})


}

关于ios - 如何在 Swift 中从 AWS Mobile Hub 检索电子邮件和电话号码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48010225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com