簡體   English   中英

window.openDatabase 不是moodle 3.8 Ionic 應用程序中的函數錯誤

[英]window.openDatabase is not a function error in moodle 3.8 Ionic app

我正在嘗試自定義 Moodle 3.8 移動應用程序,我希望它具有針對我的品牌個性化的徽標和啟動畫面。 我已經將https://github.com/moodlehq/moodlemobile2.git的 repo 克隆到我的 ubuntu 18.04 機器中,並在moodleapp 項目根目錄上運行npm install setup 我正在運行Ionic CLI 5.2.5 npm install setup成功完成后,我然后運行ionic serve --lab甚至使用 --lab 標志在我的 firefox 瀏覽器中查看我的應用程序。 該命令無錯誤地執行應用程序並在瀏覽器中初始化應用程序,但這就是問題所在,應用程序是空白的,除了黑屏之外什么也沒有顯示。

我去檢查元素,發現有一個錯誤,提示"window.openDatabase is not a function" Moodle 移動應用程序 3.8 具有使用 SQLite db 的離線數據存儲功能,我懷疑這是錯誤源,因此我安裝了ionic cordova plugin add cordova-sqlite-storagenpm install @ionic-native/sqlite到項目中,但沒有任何變化。 我幾天來一直在研究該錯誤,但沒有找到問題和解決方案的適當來源。 完整的錯誤是:

Unhandled Promise rejection: window.openDatabase is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: "window.openDatabase is not a function"
    init sqlitedb.ts:152
    SQLiteDB sqlitedb.ts:144
    SQLiteDBMock sqlitedb.ts:31
    getDB db.ts:45
    CoreAppProvider app.ts:78
    Angular 8
    invoke polyfills.js:3
    onInvoke Angular
    invoke polyfills.js:3
    run polyfills.js:3
    Angular 3
    invoke polyfills.js:3
    run polyfills.js:3
    f polyfills.js:3
    invokeTask polyfills.js:3
    runTask polyfills.js:3
    o polyfills.js:3
 SQLiteDBMock.prototype.init@http://localhost:8100/build/main.js:135760:26
SQLiteDB@http://localhost:8100/build/main.js:104930:14
SQLiteDBMock@http://localhost:8100/build/main.js:135647:28
CoreDbProvider.prototype.getDB@http://localhost:8100/build/main.js:83056:42
CoreAppProvider@http://localhost:8100/build/main.js:4415:30
_createClass@http://localhost:8100/build/vendor.js:11317:20
_createProviderInstance$1@http://localhost:8100/build/vendor.js:11281:26
initNgModule@http://localhost:8100/build/vendor.js:11234:28
NgModuleRef_@http://localhost:8100/build/vendor.js:12489:21
createNgModuleRef@http://localhost:8100/build/vendor.js:12478:12
debugCreateNgModuleRef@http://localhost:8100/build/vendor.js:14812:12
NgModuleFactory_.prototype.create@http://localhost:8100/build/vendor.js:15950:25
PlatformRef.prototype.bootstrapModuleFactory/<@http://localhost:8100/build/vendor.js:5876:78
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14976
onInvoke@http://localhost:8100/build/vendor.js:5134:33
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14916
F</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10143
NgZone.prototype.run@http://localhost:8100/build/vendor.js:4951:69
PlatformRef.prototype.bootstrapModuleFactory@http://localhost:8100/build/vendor.js:5874:23
PlatformRef.prototype.bootstrapModule/<@http://localhost:8100/build/vendor.js:5953:59
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14976
F</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10143
f/<@http://localhost:8100/build/polyfills.js:3:20242
F</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15660
F</c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:10834
o@http://localhost:8100/build/polyfills.js:3:7894
polyfills.js:3:20723
    onUnhandledError http://localhost:8100/build/polyfills.js:3
    r http://localhost:8100/build/polyfills.js:3
    microtaskDrainDone http://localhost:8100/build/polyfills.js:3
    microtaskDrainDone http://localhost:8100/build/polyfills.js:3
    o http://localhost:8100/build/polyfills.js:3

​

我堅持這一點,任何幫助表示贊賞。

不確定您是否仍然堅持這一點,但以防萬一其他人有同樣的問題:這種行為似乎與使用 firefox 有關。 使用chromium-browser 不會拋出這個異常。

Moodle 移動開發團隊建議使用 Chromium進行桌面開發,盡管他們可能應該說這是必需的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM