Guest User

Untitled

a guest
Apr 4th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
  2. {
  3.  
  4. switch (alertView.alertViewStyle)
  5. {
  6. case UIAlertViewStylePlainTextInput:
  7. {
  8. UITextField *textField = [alertView textFieldAtIndex:0];
  9. NSLog(@"Plain text input: %@",textField.text);
  10. NSString *original = textField.text;
  11. NSString *lowercase = [original lowercaseString];
  12.  
  13. NSLog(@"lowercase == %@",lowercase);
  14. // [PFUser requestPasswordResetForEmailInBackground:@"[email protected]"];
  15.  
  16. [PFUser requestPasswordResetForEmailInBackground:lowercase block:^(BOOL succeeded, NSError * _Nullable error) {
  17. NSLog(@"error == %@",error);
  18. if(error){
  19. [[[UIAlertView alloc] initWithTitle:@"Password Reset Error"
  20. message:@"There was a Error reseting your email."
  21. delegate:nil
  22. cancelButtonTitle:@"ok"
  23. otherButtonTitles:nil] show];
  24.  
  25. } else if (!error){
  26. [[[UIAlertView alloc] initWithTitle:@"Password Reset"
  27. message:@"An email containing information on how to reset your password has been sent to your email."
  28. delegate:nil
  29. cancelButtonTitle:@"ok"
  30. otherButtonTitles:nil] show];
  31. }
  32.  
  33. }];
  34.  
  35.  
  36.  
  37.  
  38. }
  39. break;
  40.  
  41. case UIAlertViewStyleSecureTextInput:
  42. {
  43. UITextField *textField = [alertView textFieldAtIndex:0];
  44. NSLog(@"Secure text input: %@",textField.text);
  45. }
  46. break;
  47.  
  48. case UIAlertViewStyleLoginAndPasswordInput:
  49. {
  50. UITextField *loginField = [alertView textFieldAtIndex:0];
  51. NSLog(@"Login input: %@",loginField.text);
  52.  
  53. UITextField *passwordField = [alertView textFieldAtIndex:1];
  54. NSLog(@"Password input: %@",passwordField.text);
  55. }
  56. break;
  57.  
  58. default:
  59. break;
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment