In my ViewController, I am connecting to a web service to validate user credentials and waiting to see if they were valid. The NSURLConnection is executed from an IBAction button press:
// Executes after a successful connection and data download
-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
// Stop the spinners
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
[aiSpinner stopAnimating];
//Perform actions based on the status code
switch(statusCode)
{
// Success
case 200:
{
[self performSegueWithIdentifier:@"SegueFromLogin" sender:self];
break;
}
// Bad Request - incorrect POST parameters
case 400:
{
// Display error
break;
}
// Other cases
default:
break;
}
}
When the next Story Board view is in the process of loading, the thread “Thread 6 com.apple.NSURLConnectionLoader” is still active. Should I be concerned with this and is the proper way to execute method calls and segues after a connection is finished?
It looks like as soon as the next storyboard/view is loaded, all of the parent and child threads are cleaned up.