title: Lifecycle in MvvmCross
body: <p>I have an Mvvmcross app that has a TableViewController in root. Each row opens a DetailViewController. And inside each one of it, you can edit it in a EditViewController.</p>
  
  <p>So I have a ViewModel for each view. I'm dealing with two problems here:</p>
  
  <p>1 ) In DetailViewController i subscribe it to a database message. When i close it, i gotta dispose this subscribeToken. So i would need to call this when DetailViewController got destroyed. But cant call it when it disappears, because when I open editViewController it will send a message that DetailViewController gotta listen to.</p>
  
  <p>So I cannot dispose it in ViewDidDisappear method. But the other option would be in ViewDidUnload. But this method is only called in MemoryWarnings. So it is not disposing the token. That is not good .</p>
  
  <p>2) The other problem is: for each DetailsViewcontroller that i open, i have to save in Settings what is the current id. and then when I leave, i have to remove it from Settings. So the same problem here. If i remove it in ViewDidDisappear it will remove when i'm in EditViewController, and i cant, it gotta be set there. But then if i remove only in ViewDidUnload it will not be called, and this variable must be removed.</p>
  
  <p>When should I call the OnDestroy method to both cases?</p>
  
  <p>In Android i'm calling in OnDestroy. Where should i call it in iOS?</p>
  
  <p>Thanks in regards,</p>