My project uses the oauthconsumer code in it.
When I am compiling and analising my code I get a noticed about an ‘Object sent- autorelease too many times’.
It would be a fair assumption to make the code was written by a lot better engineer than me so I hesitate to ‘fix’ it.
Is the following code wrong?
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
OAServiceTicket *ticket = [[OAServiceTicket alloc] initWithRequest:request
response:response
data:responseData
didSucceed:[(NSHTTPURLResponse *)response statusCode] < 400];
[ticket autorelease]; // HERE
[delegate performSelector:didFinishSelector withObject:ticket withObject:responseData];
[ticket release], ticket = nil; //HERE
}
Is that good code or should the auto release get removed?
Just remove the autorelease and you’ll be fine. The better engineer clearly made a mistake.