Guest User

Untitled

a guest
Jan 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. self.authenticationOperation = [ApplicationDelegate.mainAuthenticator
  2. authenticateWithUser:[usernameTextField text]
  3. withPassword:[passwordTextField text]];
  4. NSString *responseData = [self.authenticationOperation responseString];
  5. // This prints nothing at all, and I can't see anything with breakpoints.
  6. // Only meaningless characters.
  7. NSLog(@"RESPONSE: %@", responseData);
  8.  
  9. if ([responseData isEqualToString:@"2"]) {
  10. UIAlertView *inactiveSyntaxAlert=[[UIAlertView alloc]
  11. initWithTitle:@"Login status"
  12. message:@"Log in is unavailable. Please confirm your e-mail adress."
  13. delegate:self cancelButtonTitle:@"I did, let me try again"
  14. otherButtonTitles:nil, nil, nil];
  15. [inactiveSyntaxAlert show];
  16. }
  17. else if([responseData isEqualToString:@"1"]) {
  18. NSLog(@"Login SUCCESS");
  19. UIAlertView *successSyntaxAlert=[[UIAlertView alloc]
  20. initWithTitle:@"Login status" message:@"Logged in successfully"
  21. delegate:self
  22. cancelButtonTitle:@"Thanks"
  23. otherButtonTitles:nil, nil, nil];
  24. [successSyntaxAlert show];
  25. } else {
  26. NSLog(@"Login FAILED");
  27. UIAlertView *failureSyntaxAlert=[[UIAlertView alloc]
  28. initWithTitle:@"Login status"
  29. message:@"Log in failed"
  30. delegate:self
  31. cancelButtonTitle:@"Ok"
  32. otherButtonTitles:nil, nil, nil];
  33. [failureSyntaxAlert show];
  34. }
  35.  
  36. NSString *responseData = [self.authenticationOperation
  37. responseStringWithEncoding:NSASCIIStringEncoding];
  38. NSLog(@"RESPONSE: %@", responseData);
  39.  
  40. -(NSString*)responseString {
  41.  
  42. return [self responseStringWithEncoding:self.stringEncoding];
  43. }
  44.  
  45. -(NSString*) description {
  46.  
  47. NSMutableString *displayString = [NSMutableString stringWithFormat:@"%@nRequestn-------n%@",
  48. [[NSDate date] descriptionWithLocale:[NSLocale currentLocale]],
  49. [self curlCommandLineString]];
  50.  
  51. NSString *responseString = [self responseString];
  52. if([responseString length] > 0) {
  53. // THIS IS WHERE THE RESPONSE IS.
  54. // According to this responseString is what I need.
  55. // Still there seems I am doing something wrong because
  56. // I can't get the value on MY code.
  57. [displayString appendFormat:@"n--------nResponsen--------n%@n", responseString];
  58. }
  59.  
  60. return displayString;
  61. }
Add Comment
Please, Sign In to add comment