Search code examples
angularjscordovaionic-frameworkphonegap-plugins

How to restart Ionic app in IOS


I am developing an ionic app for android and IOS. If any error occurred from server side or from client side the app gets restated. I am able to develop it for android using

navigator.app.loadUrl("file:///android_asset/www/index.html"

but for IOS I am not able to do this. Please let me know any solution for IOS.

I know there is $state.go() or windows.reload but this not worked for me because the some AppHub.On signals event are not initialize properly. Just only one solution will work for me just like android, but I am not able to do this same for IOS.


Solution

  • I am able to solve this issue

    var initialHref = window.location.href;
    navigator.splashscreen.show();
    // Reload original app url (ie your index.html file)
    window.location = initialHref;
    navigator.splashscreen.hide();