HarmonyOS 鸿蒙Next 按照官方文档实现云数据库功能,在真机上提示没有权限
HarmonyOS 鸿蒙Next 按照官方文档实现云数据库功能,在真机上提示没有权限
返回的错误信息:
Code: 1008231001, message: 2001015:permission denied.
已经增加metadata
“metadata”: [ // 配置信息如下
{
“name”: “client_id”,
“value”: “xxxxxxxxx”
}
],
rawfile 文件夹下也添加了schema.json文件
代码如下:
async loadCloudDatabase(): Promise<void> {
try {
let databaseZone = cloudDatabase.zone(‘TOTP’);
let condition = new cloudDatabase.DatabaseQuery(UserInfo);
condition.equalTo(‘union_id’, ‘string_123’);
let bookInfoArray = await databaseZone.query(condition);
console.info(Succeeded in querying , result:${JSON.stringify(bookInfoArray)}
);
} catch (err) {
console.error(Failed to query , Code: ${err.code}, message: ${err.message}
);
}
}