Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         AWSServiceConfiguration *serviceConfiguration = [[AWSServiceConfiguration alloc] initWithRegion:CognitoIdentityUserPoolRegion credentialsProvider:nil];
  2.  
  3.         AWSCognitoIdentityUserPoolConfiguration *userPoolConfiguration = [[AWSCognitoIdentityUserPoolConfiguration alloc] initWithClientId:self.CognitoIdentityUserPoolAppClientId clientSecret:self.CognitoIdentityUserPoolAppClientSecret poolId:self.CognitoIdentityUserPoolId];
  4.  
  5.         [OverideAWSCognitoIdentityUserPool registerCognitoIdentityUserPoolWithConfiguration:serviceConfiguration userPoolConfiguration:userPoolConfiguration forKey:@"UserPool"];
  6.  
  7.         self.Pool = [OverideAWSCognitoIdentityUserPool CognitoIdentityUserPoolForKey:@"UserPool"];
  8.  
  9.         self.credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:CognitoIdentityUserPoolRegion identityPoolId:self.arnIdentityPoolId identityProviderManager:self.Pool];
  10.  
  11.         AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:CognitoIdentityUserPoolRegion credentialsProvider:self.credentialsProvider];
  12.         [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
  13.  
  14.         self.syncClient = [AWSCognito defaultCognito];
  15.  
  16.         [[self.credentialsProvider getIdentityId] continueWithBlock:^id _Nullable(AWSTask<NSString *> * _Nonnull task) {
  17.             dispatch_async(dispatch_get_main_queue(), ^{
  18.                 if(task.error){
  19.                     NSLog(@"!!!!!!!!!!!!!!!!!!!!!!!!!!!!! error : %@", task.error);
  20.                     NSLog(@"!!!!!!!!!!!!!!!!!!!!!!!!!!!!! error : %@", task.error.userInfo);
  21.                     CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:task.error.userInfo[@"NSLocalizedDescription"]];
  22.                     [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
  23.                 } else {
  24.                     NSLog(@"identityId : %@", task.result);
  25.                     NSString *keyString = [options objectForKey:@"key"];
  26.  
  27.                     NSString *value = [self.dataset stringForKey:keyString];
  28.  
  29.                     NSLog(@"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Result value :");
  30.                     NSLog(value);
  31.  
  32.                     CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Initialization successful"];
  33.                     [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
  34.                 }
  35.             });
  36.             return nil;
  37.         }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement