How to restart Ionic app in IOS


#1

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.


#2

you can try
$location.path(url);
But $location.path() does not reload the page, if you do want a reload, you have to use $window.location.href or window.location.reload()


#3

here I am passing ripple url but its still not redirecting to login page
$location.path(“http://localhost:8100/#/login”);
window.location.reload();

I want to be redirectd it to index.html page


#4

try
$location.path(’/login’);


#5

I want to be redirectd it to index.html page


#6

its not working $location.path(’’) showing me the same page. not going on index.html page


#7

How about this:
window.location.href = “file:///android_asset/www/index.html”;
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true,
historyRoot: true
});

It should work in iOS as long as you do the state changes from indexCtrl and make urlrouter.otherwise("/");( PS: I have never done that )


#8

I solve this issue using.

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

thanks for your replys


#9

Just out of curiousity, does navigator.splashscreen.show(); clear the view cache as your intent is to restart the app, i believe you should clear the history.