Question
Question

Reputation: 145

No available storage method found

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]
})

Upvotes: 5

Views: 8760

Answers (2)

Cedric Ipkiss
Cedric Ipkiss

Reputation: 6337

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

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

Upvotes: 1

Ashok Durai
Ashok Durai

Reputation: 41

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]
    }),

Upvotes: 4

Related Questions