简体   繁体   中英

Ionic transitions getting white page only in ios

Im developing an app in ionic and its working perfectly fine in android, emulators and web (with ionic serve). But when is running in ios devices in transitions between pages suddenly it shows a white view instead the view that it have to display. This doesn't happen all time and i didn't figured out when specifically happen.

I appreciate any help.

it is probably a javascript error. To find it, the best way is:

  1. first connect the phone with your mac (must be a mac) by USB.
  2. Open Safary (no Chrome or Firefox)
  3. In the Safary settings -> Advanced -> enable develop tools 在此处输入图片说明
  4. Now on Safary will appear a develop menu on the top, click on it and you will see your phone and the app running, click on it. 在此处输入图片说明
  5. In the develop tools, will appear all the console you normally see testing with ionic serve, but in the real device.
  6. Just use the app and when you get a black page check the javascript error on safary develop tool. 在此处输入图片说明

I hope it helps, it did helped me a lot after discover it.

Finally I resolve it, it was a problem with transitions of ionic in ios. Adding this line to config in app.js like this

    .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) { 
        $ionicConfigProvider.views.swipeBackEnabled(false);
    }

Disable all back navigations transitions with swipe.

For what I searched, it can be a lot of things.. What helped me to figure out my case was small commits. Anyway, I tried to use default param values and it doesn't work for my webview in iOS. If that's your problem too, you can see an alternative way to do default param values here: Set a default parameter value for a JavaScript function

didn't work:

function(param = defaultValue){}

did work:

function(param){    
  param = param ? param : defaultValue;
}

只需在您的ion-view元素上使用can-swipe-back="false"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM