I am using following code to get results from server
NSString *queryString = @"MyString"
NSString *response = [NSString stringWithContentsOfURL:[NSURL URLWithString:queryString] encoding:NSUTF8StringEncoding error:&err];
NSLog(@"%@",response);
if (err != nil)
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"Error"
message: @"An error has occurred. Kindly check your internet connection"
delegate: self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[indicator stopAnimating];
}
else
{
//BLABLA
}
The problem with this code is ,If server shows lag and it takes lets say 3 seconds to get this response
NSString *response = [NSString stringWithContentsOfURL:[NSURL URLWithString:queryString]
For 3 seconds my iPhone screen is jammed. How can i make it run in background so that it won't slow down or jam the mobile
Regards