AWS用户池设置(Swift)

时间:2016-06-15 15:05:27

标签: ios swift amazon-web-services

我正在尝试使用AWS Cognito用户池为我的swift iOS应用添加登录/注册功能。我用Cocoapods设置了我的xcworkspace。在我的App Delegate中,我已经设置了下面的凭据提供程序和服务配置。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    let credentialsProvider = AWSCognitoCredentialsProvider(regionType: AWSRegionType.USEast1, identityPoolId: cognitoIdentityPoolId)

    let defaultServiceConfiguration = AWSServiceConfiguration(region: AWSRegionType.USEast1, credentialsProvider: credentialsProvider)

    AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = defaultServiceConfiguration

    return true
}

但是当我尝试使用以下命令设置用户池配置时

let configurationUserPool = AWSCognitoIdentityUserPoolConfiguration(clientId: "###", clientSecret: "#########", poolId: "###")

我收到编译错误"使用未解析的标识符AWSCognitoIdentityUserPoolConfiguration",我不明白,因为我导入了AWSCore和AWSCognito

非常感谢任何帮助或见解,谢谢

1 个答案:

答案 0 :(得分:4)

导入AWSCognitoIdentityProvider

还必须添加到项目中并导入AppDelegate类,以便可以访问该方法。