SQLite没有打开数据库并且没有显示任何错误

时间:2018-07-16 08:46:18

标签: reactjs react-native

我正在使用['data'],已经阅读了文档(https://github.com/andpor/react-native-sqlite-storage),不知道为什么数据库没有打开,我正在android模拟器上运行该应用程序,我将数据库放在['123456']中,仿真器甚至没有显示错误,请提供任何帮助,我一直在努力解决此错误:(

react-native-sqlite-storage

1 个答案:

答案 0 :(得分:0)

尝试将数据库android/app/src/assets移至android/app/src/main/assets/

Android数据库路径: android \ app \ src \ main \ assets \ .db

iOS数据库路径: ios /../ www / .db

if (Platform.OS === 'ios') {
    db = SQLite.openDatabase({name: '<dbname>.db', createFromLocation: 1}, (open) => {}, (e) => {});
}
else {
    db = SQLite.openDatabase({name: '<dbname>.db', createFromLocation: '~/<dbname>.db', location: 'Library'}, (open) => {}, (e) => {});
}