i have the following method
-(void)request
{
responseData = [[NSMutableData data] retain];
NSString *post = [NSString stringWithFormat:@"id=%d&a_id=&d",1,1];
NSLog(@"%@",post);
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:kWebURL@"/req/request.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
[postLength release];
[postData release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[connection release];
}
My problem is that there is a leak with the nsmutableurlrequest object. I think i should release it somewhere, but when i try to do so, i get an exec_bad_access. Whereever i try to release it i get that error at the end of the connectionDidFinishLoading method.
EDIT: It looks like i can either release the NSURLConnection object OR the NSMutableURLConnection object.
If i try to remove both of them when i should, i get an exec_bad_access