Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. NSLog(@"WEB SERVICE CALLED!");
  2.  
  3. NSURL *aUrl = [NSURL URLWithString:@"xxx"];
  4. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:aUrl
  5. cachePolicy:NSURLRequestUseProtocolCachePolicy
  6. timeoutInterval:60.0];
  7.  
  8. [request setHTTPMethod:@"POST"];
  9. NSString *postString = @"grant_type=password&username=xxx&password=xxx";
  10. [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
  11.  
  12. NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request
  13. delegate:self];
  14.  
  15. if(connection) {
  16. NSLog(@"Connection Successful");
  17. } else {
  18. NSLog(@"Connection could not be made");
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement