Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用AWS SDK iOS版本2.6.1登录后无法访问用户详细信息用户名、imageURL_Ios_Swift_Amazon Web Services - Fatal编程技术网

使用AWS SDK iOS版本2.6.1登录后无法访问用户详细信息用户名、imageURL

使用AWS SDK iOS版本2.6.1登录后无法访问用户详细信息用户名、imageURL,ios,swift,amazon-web-services,Ios,Swift,Amazon Web Services,我尝试在使用AWS SDK iOS登录后访问用户名和用户图像url,但出现以下错误: “AWSIdentityManager”类型的值没有成员“identityProfile” 虽然相同的代码在以前的SDK(2.5.10)中运行良好, 请在登录后帮助我获取用户详细信息 我当前的SDK版本是2.6.1 这是我的密码:- if let identityUserName = identityManager.identityProfile?.userName { print

我尝试在使用AWS SDK iOS登录后访问用户名和用户图像url,但出现以下错误:

“AWSIdentityManager”类型的值没有成员“identityProfile” 虽然相同的代码在以前的SDK(2.5.10)中运行良好, 请在登录后帮助我获取用户详细信息

我当前的SDK版本是2.6.1

这是我的密码:-

     if let identityUserName = identityManager.identityProfile?.userName {
          print("User ID\( identityManager.identityId!)")
           print("User name\(identityUserName)")
        }


        if let imageURL = identityManager.identityProfile?.imageURL {
         print(imageURL)               
        }
如果我使用自定义登录,我可以使用以下代码访问用户名,但是如果我尝试使用Facebook或Gmail登录,我得到的响应为零

代码:-

let currUserPool = AWSCognitoIdentityUserPool.default()

let currUser = currUserPool.currentUser()

let username = currUser?.username

从AWS Mobile Hub下载的示例应用程序具有IdentityProfile,可帮助您检索用户名和imageURL。2011年8月31日,从示例应用程序中删除了IdentityProfile,并将AWSideEntityManager移动到一个SDK库中,该库可作为
pod'AWSAuthCore',“~>2.6”
如果您正在使用CoCoaPod

对于用户池:

要从UserPoolsSignIn检索用户名,可以执行以下操作:

添加此导入:

import AWSUserPoolsSignIn

AWSCognitoUserPoolsSignInProvider.sharedInstance().getUserPool().currentUser()?.username
对于Facebook:

对于谷歌: