作者:隐姓埋名er | 来源:互联网 | 2023-01-29 19:15
我在ionic2中使用Sqlite进行编码,但我接受此错误"无法打开数据库cordova_not_available".我怎么解决这个问题
Thanx寻求帮助.
我的错误(无法打开数据库cordova_not_available)
我的守则;
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
import { TabsPage } from '../pages/tabs/tabs';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = TabsPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
let db = new SQLite();
db.create({
name: "iothook.db",
location: "default"
}).then((db1:SQLiteObject) => {
db1.executeSql("CREATE TABLE IF NOT EXISTS kullanici (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT , token TEXT , user_id INTEGER)", {}).then((data) => {
console.log("TABLE CREATED: ", data);
}, (error) => {
console.error("Unable to execute sql", error);
})
}, (error) => {
console.error("Unable to open database", error);
});
});
}
}
小智..
5
Cordova功能仅适用于移动设备.浏览器不支持它们.
1> 小智..:
Cordova功能仅适用于移动设备.浏览器不支持它们.