0
我正在構建使用Amazon MobileHub的iOS應用程序。目前它與Cognito相關聯,註冊和登錄流程非常好。AWS Cognito檢查並獲取用戶
我想實現的目標是讓一個用戶能夠添加另一個用戶作爲的朋友可以這麼說。爲了做到這一點,我需要檢查具有特定用戶名的用戶是否存在,如果有,請獲取某些屬性,如該用戶的名稱。
我試過使用獲取用戶>獲取詳細信息功能,但它給了我一個錯誤認證代理沒有設置。
這是我使用的代碼:
var pool: AWSCognitoIdentityUserPool?
let user = pool?.getUser(usernameField.text!)
self.pool = AWSCognitoIdentityUserPool.init(forKey: AWSCognitoUserPoolsSignInProviderKey)
user?.getDetails().continueWith { (task: AWSTask<AWSCognitoIdentityUserGetDetailsResponse>) -> Any? in
if let error = task.error as NSError? {
print("ERROR: " + error.localizedDescription)
return ""
}
print(task.result)
return ""
}
我想到的一個方法是存儲用戶名,我想訪問DynamoDB,然後訪問它存在的屬性,但將只創建雙不必要的條目。