No available storage method found

Viewed 4980

My ionic app doesn't work on IOS, but it works on android and browsers like chrome and safari. The only error reported is when starting the application regarding storage creation. Why can't I use storage on IOS? How can I solve it?

Error:

core.js:6014 ERROR Error: Uncaught (in promise): Error: No available storage method found.

NgModule:

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    IonicStorageModule.forRoot({
      dbKey: '_ionickey',
      driverOrder: ['IndexedDB', 'WebSQL', 'localstorage'],
      name: '_ionicstorage',
      storeName: '_ionickv'
    }),
    AppRoutingModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
2 Answers

Below solution is working fine for me. Please add below code in the app.module.ts

import { Drivers } from '@ionic/storage';

IonicStorageModule.forRoot({
      name: '__mydb',
      driverOrder: [Drivers.IndexedDB, Drivers.LocalStorage]
    }),

For me, I simply had to delete the driverOrder property from the IonicStorageModule.forRoot argument object, leaving just name:

    IonicStorageModule.forRoot({ name: '_office_planner'})
Related