Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. AWSCognitoIdentityUserAttributeType * phone = [AWSCognitoIdentityUserAttributeType new];
  2. phone.name = @"phone_number";
  3. //phone number must be prefixed by country code
  4. phone.value = @"+15555555555";
  5. AWSCognitoIdentityUserAttributeType * email = [AWSCognitoIdentityUserAttributeType new];
  6. email.name = @"email";
  7. email.value = @"email@mydomain.com";
  8.  
  9. //register the user
  10. [[pool signUp:@"username" password:@"password" userAttributes:@[email,phone] validationData:nil] continueWithBlock:^id _Nullable(AWSTask<AWSCognitoIdentityUserPoolSignUpResponse *> * _Nonnull task) {
  11. dispatch_async(dispatch_get_main_queue(), ^{
  12. if(task.error){
  13. [[[UIAlertView alloc] initWithTitle:task.error.userInfo[@"__type"]
  14. message:task.error.userInfo[@"message"]
  15. delegate:self
  16. cancelButtonTitle:@"Ok"
  17. otherButtonTitles:nil] show];
  18. }else {
  19. AWSCognitoIdentityUserPoolSignUpResponse * response = task.result;
  20. if(!response.userConfirmed){
  21. //need to confirm user using user.confirmUser:
  22. }
  23. }});
  24. return nil;
  25. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement