使用Amazon Cognito开发者身份

cdu*_*dub 5 objective-c amazon-web-services ios amazon-cognito aws-sdk-ios

我正在关注亚马逊文档,但它不像宣传的那样工作.我也有最新的sdk.self.identity =下面的代码不起作用,因为它是只读的.

@implementation DeveloperAuthenticatedIdentityProvider
/*
 * Use the token method to communicate with your backend to get an
 * identityId and token.
 */

- (AWSTask <NSString*>) token {
    //Write code to call your backend:
    //Pass username/password to backend or some sort of token to authenticate user
    //If successful, from backend call getOpenIdTokenForDeveloperIdentity with logins map 
    //containing "your.provider.name":"enduser.username"
    //Return the identity id and token to client
    //You can use AWSTaskCompletionSource to do this asynchronously

    // Set the identity id and return the token
    self.identityId = response.identityId;
    return [AWSTask taskWithResult:response.token];
}

@end
Run Code Online (Sandbox Code Playgroud)

我该如何纠正这个?谢谢.

pai*_*aiv 2

您的其他问题中有编译器错误,请先修复这些错误使用 AWS Cognito 和 aws-ios-sdk v.2.4.16 与开发人员身份

根据编译器的建议,该方法的正确签名是

- (AWSTask<NSString *> *)token;
Run Code Online (Sandbox Code Playgroud)