ios - UIViewController Destructor not being called -


currently have 2 uiviewcontrollers called forma , formb

now forma calls formb such (formb property in forma nonatomic , strong)

self.formb = [[ mediaplayer alloc] initwithnibname:@"mediaplayer" bundle:nil ]; //pass values formb (all of these fields strong) ((formb*)self.formb).songinprogress_name= songname; ((formb*)self.formb).songinprogress_path= song_path; ((formb*)self.formb).musiccollectionpath= self.arraysongnamepath; [self presentviewcontroller:self.formb animated:true completion:nil]; 

and when formb attempts close goes forma such

[ ((forma*)self.presentingviewcontroller) backhere]; 

now in forma. forma attempts close formb in way

[self.presentedviewcontroller dismissviewcontrolleranimated:true completion:nil];  self.formb = nil; 

doing above not call destructor in formb is

-(void)dealloc {      /* desructor*/ } 

why si destructor not being called ?

this might not source of problem, should never this:

self.formb = [[ mediaplayer alloc] initwithnibname:@"mediaplayer" bundle:nil ]; 

it not business retain strong reference view controller presented. view hierarchy going retain it. not owner; view hierarchy is. must not take ownership. make local variable when create , present view controller:

mediaplayer* mp = [[ mediaplayer alloc] initwithnibname:@"mediaplayer" bundle:nil ]; mp.songinprogress_name = songname; // etc. [self presentviewcontroller:mp animated:true completion:nil]; 

now, said @ start, important might not source of problem. may have retain cycle inside implementation of mediaplayer. didn't show of code, have no way of knowing. why not use instruments , leaks template find out retain cycle is?


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -