Ionic 3 failing on first start for iOS 12 wiith plugin_not_installed

221 views Asked by At

My app white-screens on the first start after install on iOS 12 (at least on an iPhone 5s and a 6 that are both stuck on 12). If I swipe away the app and open it again it works correctly. I've reviewed the console logs, and the white-screens seem to be plugin_not_installed errors.

Is there some more logging I can turn on to figure out which plugin is failing to load on the first run?

Or am I looking in a wrong place?

2

There are 2 answers

0
Delwyn Pinto On

The application failing only on first launch makes me believe that the plugins are installed, but during launch, some plugin code is getting executed before it has been initialized.

For starters, I would ensure that all plugin related code is executed only after they have been loaded. You can do this by subscribing to the platform ready event & executing plugin code only after that is fired. An example of this would be import { Platform } from 'ionic-angular';

@Component({...})
export MyApp {
  constructor(public plt: Platform) {
    this.plt.ready().then((readySource) => {
      console.log('Platform ready from', readySource);
      // Platform now ready, execute any required native code
    });
  }
}

Additionally, logging the cordova code might not help you much in narrowing down the problem. Since you face this on iOS, I'd recommend checking the logs in Xcode to aid in your investigation of this error.

0
Crag On

I found which plugin was missing by looking at the JS console through Safari- it was obvious because of the way Safari highlights warning messages. Ionic logs a warning with the plugin name, e.g.:

Ionic Native: tried accessing the SQLite plugin but it's not installed.

This should show in Xcode's console, too, but I hadn't noticed this log line - it happened long before the code stopped working, but you should be able to filter on part of that message to find it.

I fixed this by finding the code that was trying to use this plugin from a provider's constructor and wrapped that in a 'platform.ready()' check.