Mvx ViewModel SaveStateToBundle and ReloadFromBundle overrides do not fire

CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭
edited February 2016 in Xamarin.iOS

I have three Mvx ViewModels (i.e. inherit from MvxViewModel) in which I have created all of the overrides as so:

        public override void Start()
        {
            Debug.WriteLine("*** Start");
        }
        protected override void InitFromBundle(IMvxBundle parameters)
        {
            Debug.WriteLine("*** InitFromBundle");
        }
        protected override void ReloadFromBundle(IMvxBundle state)
        {
            Debug.WriteLine("*** ReloadFromBundle");
        }
        protected override void SaveStateToBundle(IMvxBundle bundle)
        {
            Debug.WriteLine("*** SaveStateToBundle");
        }

We have two problems, both of which we test by pressing CMD-SHIFT-H to make the app suspend by disappearing into the background, and then CMD-SHIFT-H-H (double click on the H) to make the app partially visible again so that we can click it to resume it.

  1. Although there is Debug output for Start and InitFromBundle when the app is started and we navigate to that screen (ViewModel), when we go CMD-SHIFT-H, there isn't any Debug output for SaveStateToBundle, nor any Debug output for ReloadFromBundle when CMD-SHIFT-H-H and clicking on the app to resume it.

  2. When we change the values in text boxes from ones that have already been entered and navigated away from and returned to, then a new value entered to overwrite the previous one and then suspending the app and resuming it as above, the newly entered value reverts to the old one when the CMD-SHIFT-H => CMD-SHIFT-H-H + APP CLICK process is followed.

We think that the matter that the SaveStateToBundle and ReloadFromBundle overrides are not called means that we can't err on the side of safety and persists data by default ... but they are not called, hence our hands are tied.

Any theories?

Sign In or Register to comment.