Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AWSCognitoIdentityUserAttributeType * phone = [AWSCognitoIdentityUserAttributeType new];
- phone.name = @"phone_number";
- //phone number must be prefixed by country code
- phone.value = @"+15555555555";
- AWSCognitoIdentityUserAttributeType * email = [AWSCognitoIdentityUserAttributeType new];
- email.name = @"email";
- email.value = @"email@mydomain.com";
- //register the user
- [[pool signUp:@"username" password:@"password" userAttributes:@[email,phone] validationData:nil] continueWithBlock:^id _Nullable(AWSTask<AWSCognitoIdentityUserPoolSignUpResponse *> * _Nonnull task) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if(task.error){
- [[[UIAlertView alloc] initWithTitle:task.error.userInfo[@"__type"]
- message:task.error.userInfo[@"message"]
- delegate:self
- cancelButtonTitle:@"Ok"
- otherButtonTitles:nil] show];
- }else {
- AWSCognitoIdentityUserPoolSignUpResponse * response = task.result;
- if(!response.userConfirmed){
- //need to confirm user using user.confirmUser:
- }
- }});
- return nil;
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement