Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. NSURL *url = nil;
  2. NSMutableURLRequest *request = nil;
  3.  
  4. NSString *getURL = [NSString stringWithFormat:@"%@?TEST=%@",URL, str];
  5.  
  6. url = [NSURL URLWithString: getURL];
  7. request = [NSMutableURLRequest requestWithURL:url];
  8. [request setHTTPMethod:@"GET"];
  9. [request addValue: @"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
  10.  
  11. NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  12.  
  13. if(connection) //Always true!!!
  14. {
  15. mutableData = [NSMutableData new];
  16. NSLog(@"SERVER CONNECTION OK");
  17. }
  18. else
  19. {
  20. NSLog(@"NO SERVER CONNECTION");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement