storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.15k stars 715 forks source link

WARN: Native: tried accessing the SQLite plugin but it's not installed. (White screen of death) #1011

Closed EvolutionsSystems closed 1 year ago

EvolutionsSystems commented 1 year ago

Hello everyone.

Im getting this erro on execute the project on Xcode

ionic info

Ionic:
   Ionic CLI                     : 6.20.8 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.9.4
   @angular-devkit/build-angular : 14.2.2
   @angular-devkit/schematics    : 15.2.0
   @angular/cli                  : 14.2.10
   @ionic/angular-toolkit        : 8.0.0

Cordova:

   Cordova CLI       : 11.1.0
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)

Utility:

   cordova-res : 0.15.4
   native-run  : 1.7.1

System:

   ios-deploy : 1.12.1
   ios-sim    : 8.0.2
   NodeJS     : v16.17.1 (/usr/local/bin/node)
   npm        : 8.15.0
   OS         : macOS Monterey
   Xcode      : Xcode 14.2 Build version 14C18

Cordova plugin ls

cordova-plugin-device 2.1.0 "Device"
cordova-plugin-inappbrowser 5.0.0 "InAppBrowser"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-statusbar 3.0.0 "StatusBar"
cordova-sqlite-storage 6.0.0 "Cordova SQLite storage plugin - cordova-sqlite-storage plugin version"

npm ls

├── __ngcc_entry_points__.json@ extraneous
├── @angular-devkit/build-angular@14.2.2
├── @angular-eslint/builder@13.0.1
├── @angular-eslint/eslint-plugin-template@13.0.1
├── @angular-eslint/eslint-plugin@13.0.1
├── @angular-eslint/template-parser@13.0.1
├── @angular/animations@14.2.1
├── @angular/cdk@14.2.1
├── @angular/cli@14.2.10
├── @angular/common@14.2.1
├── @angular/compiler-cli@14.2.1
├── @angular/compiler@14.2.1
├── @angular/core@14.2.1
├── @angular/forms@14.2.1
├── @angular/language-service@14.2.1
├── @angular/material@14.2.1
├── @angular/platform-browser-dynamic@14.2.1
├── @angular/platform-browser@14.2.1
├── @angular/router@14.2.1
├── @awesome-cordova-plugins/android-permissions@6.3.0
├── @awesome-cordova-plugins/core@6.3.0
├── @awesome-cordova-plugins/device@6.3.0
├── @ionic-native/core@5.36.0
├── @ionic-native/device@5.36.0
├── @ionic-native/file@5.36.0
├── @ionic-native/sqlite@5.36.0
├── @ionic/angular-toolkit@8.0.0
├── @ionic/angular@5.9.4
├── @ionic/cli@6.20.8
├── @ionic/cordova-builders@7.0.0
├── @ionic/core@6.5.6
├── @ionic/storage-angular@3.0.6
├── @types/jasmine@3.6.11
├── @types/jasminewd2@2.0.10
├── @types/node@12.20.55
├── @typescript-eslint/eslint-plugin@5.3.0
├── @typescript-eslint/parser@5.3.0
├── angular-google-charts@2.2.3
├── cordova-android@11.0.0
├── cordova-browser@6.0.0
├── cordova-ios@6.0.0
├── cordova-plugin-android-permissions@1.1.4
├── cordova-plugin-device@2.1.0
├── cordova-plugin-inappbrowser@5.0.0
├── cordova-plugin-ionic-webview@5.0.0
├── cordova-plugin-statusbar@3.0.0
├── cordova-sqlite-storage@6.0.0
├── dom-to-image@2.6.0
├── eslint-plugin-import@2.22.1
├── eslint-plugin-jsdoc@30.7.6
├── eslint-plugin-prefer-arrow@1.2.2
├── eslint@7.32.0
├── ionicons@6.1.3
├── jasmine-core@3.8.0
├── jasmine-spec-reporter@5.0.2
├── karma-chrome-launcher@3.1.1
├── karma-coverage-istanbul-reporter@3.0.3
├── karma-coverage@2.0.3
├── karma-jasmine-html-reporter@1.7.0
├── karma-jasmine@4.0.2
├── karma@6.3.20
├── localforage@1.10.0
├── ngx-mask@14.2.2
├── protractor@7.0.0
├── rxjs@6.6.7
├── ts-node@8.3.0
├── tslib@2.4.0
├── typescript@4.7.4
└── zone.js@0.11.8

dbservice.js

constructor(private platform: Platform, public SQLite: SQLite, private file: File, 
              private srv: MainService, private storage: Storage) {
  this.platform.ready().then(() => {
      console.log("após platform ready 1");
      this.storage.create();
      this.initializeDB();
  });
}

public initializeDB() {
  this.SQLite.create({name: this.nameDB, location: 'default'})
  .then((db: SQLiteObject) => {
    //....
  })

 .catch((error: any) => {
   //...
 })
}

log Xcode

2023-02-28 16:36:07.186722-0300 TSM Sales[6350:228728] Apache Cordova native platform version 6.0.0 is starting.
2023-02-28 16:36:07.186855-0300 TSM Sales[6350:228728] Multi-tasking -> Device: YES, App: YES
2023-02-28 16:36:07.237450-0300 TSM Sales[6350:228728] CDVWKWebViewEngine: trying to inject XHR polyfill
2023-02-28 16:36:07.237744-0300 TSM Sales[6350:228728] CDVWKWebViewEngine: trying to inject XHR polyfill
2023-02-28 16:36:07.237902-0300 TSM Sales[6350:228728] CDVWKWebViewEngine: auto injecting cordova
2023-02-28 16:36:07.252805-0300 TSM Sales[6350:228728] iOS 12.2+ detected
2023-02-28 16:36:07.252928-0300 TSM Sales[6350:228728] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE"
2023-02-28 16:36:07.456223-0300 TSM Sales[6350:228728] The preference key "AllowLinkPreview" is not defined and will default to "FALSE"
2023-02-28 16:36:07.456392-0300 TSM Sales[6350:228728] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE"
2023-02-28 16:36:07.456461-0300 TSM Sales[6350:228728] CDVWKWebViewEngine will reload WKWebView if required on resume
2023-02-28 16:36:07.456525-0300 TSM Sales[6350:228728] Using Ionic WKWebView
2023-02-28 16:36:07.456912-0300 TSM Sales[6350:228728] [CDVTimer][console] 0.107050ms
2023-02-28 16:36:07.457098-0300 TSM Sales[6350:228728] [CDVTimer][handleopenurl] 0.078917ms
2023-02-28 16:36:07.460308-0300 TSM Sales[6350:228728] [CDVTimer][intentandnavigationfilter] 3.131986ms
2023-02-28 16:36:07.460535-0300 TSM Sales[6350:228728] [CDVTimer][gesturehandler] 0.096917ms
2023-02-28 16:36:07.462940-0300 TSM Sales[6350:228728] [CDVTimer][statusbar] 2.257943ms
2023-02-28 16:36:07.463172-0300 TSM Sales[6350:228728] [CDVTimer][inappbrowser] 0.089049ms
2023-02-28 16:36:07.463273-0300 TSM Sales[6350:228728] [CDVTimer][TotalPluginStartup] 6.507993ms
2023-02-28 16:36:08.792222-0300 TSM Sales[6350:228728] IAB.close() called but it was already closed.
2023-02-28 16:36:09.439345-0300 TSM Sales[6350:228728] Ionic Native: deviceready event fired after 380 ms
2023-02-28 16:36:09.439578-0300 TSM Sales[6350:228728] Ionic Native: deviceready event fired after 376 ms
2023-02-28 16:36:09.439704-0300 TSM Sales[6350:228728] após platform ready 1
2023-02-28 16:36:09.439845-0300 TSM Sales[6350:228728] WARN: Native: tried accessing the SQLite plugin but it's not installed.
2023-02-28 16:36:09.439980-0300 TSM Sales[6350:228728] WARN: Install the SQLite plugin: 'ionic cordova plugin add cordova-sqlite-storage'

log safari debug

[Log] Ionic Native: deviceready event fired after 588 ms (user-script:2, line 1413)
[Log] Ionic Native: deviceready event fired after 583 ms (user-script:2, line 1413)
[Log] após platform ready 1 (user-script:2, line 1413)
[Warning] Native: tried accessing the SQLite plugin but it's not installed. (user-script:2, line 1413)
[Warning] Install the SQLite plugin: 'ionic cordova plugin add cordova-sqlite-storage' (user-script:2, line 1413)
[Error] ERROR – Error: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'this.SQLite.create({ name: this.nameDB, location: 'default' })
            .then')
initializeDB@httpsionic://localhost/main.js:7491:71
@httpsionic://localhost/main.js:7260:34
@user-script:2:757:26
@user-script:2:125:43
@httpsionic://localhost/main.js:7257:38
onInvoke@httpsionic://localhost/vendor.js:121671:31
@httpsionic://localhost/polyfills.js:296:43
@httpsionic://localhost/polyfills.js:1716:31
onInvokeTask@httpsionic://localhost/vendor.js:121659:35
@httpsionic://localhost/polyfills.js:353:49
drainMicroTaskQueue@httpsionic://localhost/polyfills.js:823:32
@httpsionic://localhost/polyfills.js:701:32
Error: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'this.SQLite.create({ name: this.nameDB, location: 'default' })
            .then')
initializeDB@httpsionic://localhost/main.js:7491:71
@httpsionic://localhost/main.js:7260:34
@user-script:2:757:26
@user-script:2:125:43
@httpsionic://localhost/main.js:7257:38
onInvoke@httpsionic://localhost/vendor.js:121671:31
@httpsionic://localhost/polyfills.js:296:43
@httpsionic://localhost/polyfills.js:1716:31
onInvokeTask@httpsionic://localhost/vendor.js:121659:35
@httpsionic://localhost/polyfills.js:353:49
drainMicroTaskQueue@httpsionic://localhost/polyfills.js:823:32
@httpsionic://localhost/polyfills.js:701:32
    handleError (vendor.js:100002)
    next (vendor.js:122537)
    next
    __tryOrUnsub (vendor.js:24498)
    next (vendor.js:24425)
    _next (vendor.js:24361)
    next (vendor.js:24331)
    next (vendor.js:24071)
    emit (vendor.js:117604)
    (função anônima) (polyfills.js:296)
    onHandleError (vendor.js:121697)
    (função anônima) (polyfills.js:316)
    _loop_2 (polyfills.js:1476)
    (função anônima) (polyfills.js:1489)
    drainMicroTaskQueue (polyfills.js:830)
    (função anônima) (polyfills.js:701)

im execute to remove node_modules, platforms, plugins, www and install again... Im don't know what happening.... Please help

brodycj commented 1 year ago

Looks to me like an issue with your installation or your environment. Need a minimal, reproducible example: https://stackoverflow.com/help/minimal-reproducible-example

I did notice something interesting:

   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)
EvolutionsSystems commented 1 year ago

I don't know why return this in ionic info

when execute sudo cordova platform ls return

Installed platforms:
  ios 6.0.0
Available platforms: 
  android ^10.1.1
  browser ^6.0.0
  electron ^3.0.0
  osx ^6.0.0 (deprecated)

My app.component.js

 constructor(private db: DbService, 
              public srv: MainService, 
              private platForm: Platform, 
              private device: Device, 
              private cdr: ChangeDetectorRef,
              private androidPermissions: AndroidPermissions) {    

    // srv.login.access = true;
    srv.backButton();
    srv.loadingUUID = true;
    platForm.ready().then(() => {
      console.log("após platform ready 2");
      srv.loadingUUID = false;
      srv.UUID = this.device.uuid;
    });
    this.srv.cdr = cdr;

  }
EvolutionsSystems commented 1 year ago

Sorry for that close.. Miss click.

That error happened on execute by Xcode and ionic cordova run ios --livereload --consolelogs --external

EvolutionsSystems commented 1 year ago

Can anyone help me with any ideas?

brodycj commented 1 year ago

I need a reproduction project to help you with this. Must be complete so that I can try building and running it. Must be minimal, no harder for me to build than absolutely needed. No sensitive company info.

And free support has no guarantee of time, I will just help when I get a chance.

I do offer commercial support as well, please contact sales@storesafe.io if interested thanks.

EvolutionsSystems commented 1 year ago

To all that have the same problem.

I executed

ionic start "app-name" --type=angular --cordova Chose YES on capacitor integrations remove resources, node-modules, src, package.json, package-lock.json and copy all from original project. Then executed npm I I ajusted the id, version and author in config.xml ionic cordova platform add ios

On final, the problema was soved