ios - MFMailComposeViewController never deallocates -
i'm presenting mfmailcomposeviewcontroller this:
mc = [[mfmailcomposeviewcontroller alloc] init]; mc.mailcomposedelegate = self; [self presentviewcontroller:mc animated:yes completion:null]; mc = nil;
and removing delegate method:
- (void) mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { [self dismissviewcontrolleranimated:yes completion:nil]; }
the problem vc never deallocated, , opening , closing "send email" function in app eats memory doesn't release it.
what missing? don't see how can other way, , other vcs deallocate fine on own after calling dismissviewcontroller on themselves.
why set mc = nil; after presentviewcontroller:mc?
you should like:-
mc = [[mfmailcomposeviewcontroller alloc] init]; mc.mailcomposedelegate = self; [self presentviewcontroller:mc animated:yes completion:null];
then
- (void) mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { [self dismissviewcontrolleranimated:yes completion:^{ mc=nil; }]; }
by way, mfmailcomposeviewcontroller has memory leak issue. not problem, have same problem.
Comments
Post a Comment