Kishore_g
Kishore_g

Reputation: 11

My Application Crashing when using url connections

I am working on sever based project in that if i am push to 3 view controllers one by one .. each view i am requesting urls and i am getting data from the sever in this scenario it working fine but when i pop (or) coming back to previous view click in back button continuously my app crashing because the data from server not received completely and again i am requesting another url

 - (void)connectionDidFinishLoading:(NSURLConnection *)connection {

    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

    [self hideLoader];

    if (_delegate != nil) {

        NSMutableData *data = [[NSMutableData alloc]initWithData:responseData];

        [_delegate finishedReceivingData:data withRequestMessage:requestMessage];

        [data release];

    } -- getting error here..

and also i want crash report for my application is there any frameworks?

Upvotes: 0

Views: 68

Answers (1)

Avi Tsadok
Avi Tsadok

Reputation: 1843

In the dealloc method of the controller/view (depends who is your delegate) you need to nil your delegate property.

- (void)dealloc
{
   _urlConnection.delegate = nil;

[super dealloc];
}

Don't count on the nil condition. It can be deallocated, but not nil.

Upvotes: 1

Related Questions