Forum Xamarin.iOS

"viewWillAppear" not getting called on iOS 13 Xamarin.ios Native.

I am using MvvmCross, for me the viewWillAppear is getting called every time for some time interval and after that "viewWillappear" method is not getting called for any view, not even for showing a new view.

Similar behaviour on iOS 13 simulator.

I am using following versions :

Visual Studio : Version 8.3.5 (build 13)
Xamarin iOS : 13.4.0.2
MvvmCross : 4.4.0

In my baseview's ViewDidLoad() method I have added the following code but its not working with reference to this link

navigationController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;

A lot of my code depends on "viewWillAppear" I am adding sub views runtime as well those are not getting added as "viewWillAppear" not getting called.

If anyone has any idea why this is happening.

Thanks,
-Vaibhav Bangde.

Posts

  • MuneebSaeedMuneebSaeed USMember ✭✭

    Any Help Vaibhav? I'm stuck at the same position for many days.

  • MuneebSaeedMuneebSaeed USMember ✭✭

    @VaibhavBangde said:
    I am using MvvmCross, for me the viewWillAppear is getting called every time for some time interval and after that "viewWillappear" method is not getting called for any view, not even for showing a new view.

    Similar behaviour on iOS 13 simulator.

    I am using following versions :

    Visual Studio : Version 8.3.5 (build 13)
    Xamarin iOS : 13.4.0.2
    MvvmCross : 4.4.0

    In my baseview's ViewDidLoad() method I have added the following code but its not working with reference to this link

    navigationController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;

    A lot of my code depends on "viewWillAppear" I am adding sub views runtime as well those are not getting added as "viewWillAppear" not getting called.

    If anyone has any idea why this is happening.

    Thanks,
    -Vaibhav Bangde.

    Any Help? I'm also stuck at the same point.

  • OnurHazarOnurHazar USUniversity ✭✭✭

    @MuneebSaeed
    Hey, did you find any solution?

  • VaibhavBangdeVaibhavBangde USMember ✭✭

    Hi @MuneebSaeed,

    Sorry for late reply I haven't found any proper solution for this, but a temporary solution is given below.

    You can manually call viewController.viewWillAppear(); and viewController.viewDidAppear(); while calling pushViewController(viewController);

    viewController.viewWillAppear();
    navigationController.pushViewController(viewController);
    viewController.viewDidAppear();

    Currently I have done this and it's working for me.
    But it is not a proper solution and I am not considering it as the final solution for production app.

    Please let me know if you have found any better solution.

    cc: @OnurHazar

    Thanks,
    -Vaibhav Bangde.

  • MuneebSaeedMuneebSaeed USMember ✭✭

    @VaibhavBangde said:
    Hi @MuneebSaeed,

    Sorry for late reply I haven't found any proper solution for this, but a temporary solution is given below.

    You can manually call viewController.viewWillAppear(); and viewController.viewDidAppear(); while calling pushViewController(viewController);

    viewController.viewWillAppear();
    navigationController.pushViewController(viewController);
    viewController.viewDidAppear();

    Currently I have done this and it's working for me.
    But it is not a proper solution and I am not considering it as the final solution for production app.

    Please let me know if you have found any better solution.

    cc: @OnurHazar

    Thanks,
    -Vaibhav Bangde.

    Thanks for replying. I also did the same to let the app run for the time, but still status bar is creating mess in iPhone X and above. I set the app for iPhone 8 and below and now will look for X. All these are not proper solutions have to set views for each iPhone. :-(

  • MuneebSaeedMuneebSaeed USMember ✭✭

    @OnurHazar said:
    @MuneebSaeed
    Hey, did you find any solution?

    Not yet. Did same as Vaibhav Bangde.

  • VaibhavBangdeVaibhavBangde USMember ✭✭

    @MuneebSaeed and @OnurHazar is there any update on this issue, have you guys found any solution for this.

  • MartiKevinMartiKevin Member ✭✭
    edited June 11

    Bumping this thread up as well. Seems like there aren't many people who use this type of configuration, but I am having the same problem.

    While working on updating an iPad application developed with Xamarin.iOS in combination with MvvmCross (not the latest versions) I encountered this same issue on iOS13. The ViewDidAppear and ViewDidDisappear get called once at application startup, after which they do not get called again. Our views are fullscreen storyboards with a small strip in the storyboard reserved for the top bar. This strip is now displayed below the top bar, which makes me think the app is not in FullScreen, whatever I try.

    The app uses a custom ViewPresenter.

    I have looked into using UIModalPresentationStyle.FullScreen at several places, but to no avail. I checked the MasterNavigationController, which has a ModalPresentationStyle of FullScreen. Is there a specific place I should set this in my custom ViewPresenter perhaps? I can try the workaround above, but as @MuneebSaeed says this doesn't fix the status bar issue.

    I really hope there is someone with an actual fix instead of a workaround that works in this configuration. Redesigning all the screens and ViewDidAppear just isn't an option on the short term. Perhaps this is fixed in a newer version of MvvmCross?

    Edit: Attached an image as an example of how the storyboard's view now shows the statusbar part below the actual status bar:

  • MartiKevinMartiKevin Member ✭✭

    Does anyone have any recommendations or ideas about this? I will create a prototype using a couple of the screens from the iPad app in vanilla Xamarin.iOS to see if I can make it work there. If this does work I will add MvvmCross to see how that changes things. I will keep you updated on that.

    In the meantime it would be great if there is indeed someone who knows what causes these issues on older MvvmCross apps.

  • MuneebSaeedMuneebSaeed USMember ✭✭

    @MartiKevin said:
    Bumping this thread up as well. Seems like there aren't many people who use this type of configuration, but I am having the same problem.

    While working on updating an iPad application developed with Xamarin.iOS in combination with MvvmCross (not the latest versions) I encountered this same issue on iOS13. The ViewDidAppear and ViewDidDisappear get called once at application startup, after which they do not get called again. Our views are fullscreen storyboards with a small strip in the storyboard reserved for the top bar. This strip is now displayed below the top bar, which makes me think the app is not in FullScreen, whatever I try.

    The app uses a custom ViewPresenter.

    I have looked into using UIModalPresentationStyle.FullScreen at several places, but to no avail. I checked the MasterNavigationController, which has a ModalPresentationStyle of FullScreen. Is there a specific place I should set this in my custom ViewPresenter perhaps? I can try the workaround above, but as @MuneebSaeed says this doesn't fix the status bar issue.

    I really hope there is someone with an actual fix instead of a workaround that works in this configuration. Redesigning all the screens and ViewDidAppear just isn't an option on the short term. Perhaps this is fixed in a newer version of MvvmCross?

    Edit: Attached an image as an example of how the storyboard's view now shows the statusbar part below the actual status bar:

    Unfortunately i tried all possible ways but UIModalPresentationStyle.FullScreen is not playing any role in my case. I set toolbar for each class, i called ViewDidLoad manually in every class to solve my issue. This issue wasted my months.

  • MartiKevinMartiKevin Member ✭✭

    That's unfortunate. Is this with the latest version of MvvmCross? I wonder if updating MvvmCross to a latter version fixes it, but I have other issues with the framework right now that won't let me update it.

  • MartiKevinMartiKevin Member ✭✭
    edited July 8

    A little update from my side:

    I had some time to do some experimentation and remove all MvvmCross initialization from the app startup. After removing MvvmCross related things from two ViewControllers and adding native iOS style navigation to a button press on the first one I got the whole thing working. And guess what? While the NavigationController and the ViewControllers it handles have a ModalPresentationStyle of PageSheet (ModalPresentation is false though), View(Did/Will)Appear and View(Did/Will)Disappear do work!

    The MvvmCross version used is quite old, since there is another visual problem that occurs when using versions later than a certain 4.x version and some other small issues. But the actual problem does seem to be somewhere in this version of MvvmCross or the way its setup.

    I will do some more experimentation with a small scale app using the same storyboards and different versions of MvvmCross to see if I can replicate the problem in the next couple of days.

    Updates will follow.

    Edit: Forgot to say I tested on iOS 13.5.

  • MartiKevinMartiKevin Member ✭✭
    edited July 9

    Fixed the problem!

    I still had a branch from last summer with an MvvmCross update which still led to some other issues I yet have to solve. This branch, which is using MvvmCross 6.3.0 does call the View(Did/Will)Appear and View(Did/Will)Disappear methods.

    So @MuneebSaeed, @VaibhavBangde, @OnurHazar , you could try this.

    Updating MvvmCross from 4.x to 6.x is quite some work though, so be prepared. Especially if your other projects are not in .Net Standard format, which I except when using a version of MvvmCross that is that old.

    I will still try and figure out if the 5.x range also solve the problem, which is a smaller update for the short term.

    Edit: Can confirm that the calls to these methods also work in MvvmCross 5.6.3, which is super easy to update to from any 4.x version.

Sign In or Register to comment.