In a view controller i have a button which internally calls an IBAction and that internally calls the
[self showEmailModalView:FinalEmail];
now … in the showEmailModalView i have
-(void) showEmailModalView:(NSString *)email{
MFMailComposeViewController *mvc =[[[MFMailComposeViewController alloc] init]autorelease];
mvc.mailComposeDelegate = self;
NSArray *mails = [[NSArray arrayWithObject:email]autorelease];
[mvc setToRecipients:mails];
NSString*emailBody =[NSString stringWithFormat:@" "];
[mvc setMessageBody:emailBody isHTML:YES];
mvc.navigationBar.barStyle = UIBarStyleBlack;
[[self navigationController] presentModalViewController:mvc animated:YES];
}
and then
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[[self navigationController] dismissModalViewControllerAnimated:YES];
}
Now it works alright… for all the scenarios of email or delete or anything like that but right after completion of the code the simulator just throws a exec_bad_access and then does nothing…. can you help.
PS: i also found out that that when ever you are giving a release to the mvc as declared above the error is called. ant thoughts.
Update:
I did install the app with only one change… i initialized the mvc in the header file and then just use the same statement. so now i am not getting the exec_bad_access errors anymore… i think it was frightened of the nsZOMBIES….Haha… thanks for your Help and support.. guys… Both of you….
You shouldn’t autorelease this object, it’s already autoreleased :
Instead of change to: