uni-app hx3.1.4正式版 ios平台使用sqlite建表会闪退 同样代码安卓正常运行
uni-app hx3.1.4正式版 ios平台使用sqlite建表会闪退 同样代码安卓正常运行
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | Windows7 x64 | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Windows
HBuilderX类型:正式
HBuilderX版本号:3.1.4
手机系统:iOS
手机系统版本号:iOS 12.4
手机厂商:苹果
手机机型:6 plus
页面类型:vue
打包方式:云端
项目创建方式:HBuilderX
操作步骤:
无
预期结果:
正常执行
实际结果:
自定义调试基座闪退
bug描述:
```javascript
plus.sqlite.executeSql({
name: 'xljdb',
sql: 'create table if not exists database("where" CHAR(110),"location" CHAR(100),"age" INT(11))',
success: function(e) {
console.log('executeSql success!');
},
fail: function(e) {
console.log('executeSql failed: ' + JSON.stringify(e));
}
});
使用上面建表语句,ios会闪退,但安卓10能正常建表
更多关于uni-app hx3.1.4正式版 ios平台使用sqlite建表会闪退 同样代码安卓正常运行的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
这是一个典型的SQLite关键字冲突问题。在iOS平台上,SQLite对关键字检查更为严格,where和location都是SQLite保留关键字,直接用作表名会导致闪退。
解决方案是使用反引号转义关键字:
plus.sqlite.executeSql({
name: 'xljdb',
sql: 'create table if not exists database(`where` CHAR(110),`location` CHAR(100),`age` INT(11))',
success: function(e) {
console.log('executeSql success!');
},
fail: function(e) {
console.log('executeSql failed: ' + JSON.stringify(e));
}
});


