2017-06-01 77 views
0

消失我在看這個亞馬遜官方文檔:登錄變量從AWSCognitoCredentialsProvider

https://aws.amazon.com/blogs/mobile/using-amazon-cognito-with-swift-sample-app-developer-guide-and-more/

在此示例代碼中有callaed 登錄作爲AWSCognitoCredentialsProvider的部分的變量。不幸的是,當我嘗試在我的應用程序中實現這一點時,登錄變量不再存在。我檢查了類定義,它不在那裏。任何人都有關於如何恢復的想法?

let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YOUR_IDENTITY_POOL_ID") 
let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialsProvider) 

AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration 

let token = FBSDKAccessToken.currentAccessToken().tokenString 
credentialsProvider.logins = [AWSCognitoLoginProviderKey.Facebook.rawValue: token] 

回答

0

該API作爲2.5.0發行版的一部分被刪除。 Changelog

從AWSCognitoCredentialsProvider新的API是:

- (void)setIdentityProviderManagerOnce:(id<AWSIdentityProviderManager>)identityProviderManager; 

AWSIdentityProviderManager:

@protocol AWSIdentityProviderManager <NSObject> 

/** 
Each entry in logins represents a single login with an identity provider. The key is the domain of the login provider (e.g. 'graph.facebook.com') and the value is the OAuth/OpenId Connect token that results from an authentication with that login provider. 
*/ 
- (AWSTask<NSDictionary<NSString *, NSString *> *> *)logins; 

@optional 
/** 
* If the token contains the role arn and there are multiple roles, return the custom role to assume. This is currently only supported for SAML identity providers. 
*/ 
@property (nonatomic, readonly) NSString *customRoleArn; 

@end