i usually dont check the retain count untill the program leaks. But today (i donno y) i checked the retain count and now i am confused.
NSString *strErrorMessage;
strErrorMessage= [NSString stringWithFormat:@"Email and Password are mandatory"];
NSLog(@"%d", [strErrorMessage retainCount]); // retain count 1
[objAppDelegate ShowMesssage:strErrorMessage];
NSLog(@"%d", [strErrorMessage retainCount]); // retain count 3
return;
I don get this. As i dont alloc strErrorMessage, i don have to release it rite?
who has the owner ship of strErrorMessage.
-(void) ShowMesssage: (NSString *)strError
{
UIAlertView *alertError = [[UIAlertView alloc] initWithTitle:strTitle message:strError delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertError show];
[alertError release];
}
Do i have to release strError here?(i thought no, but what abt the retain count 3).