HarmonyOS鸿蒙Next中使用picker.DocumentViewPicker()读取文件时报错E[picker] DocumentSelect documentSelectConfig: {"action":"ohos.want.action.
HarmonyOS鸿蒙Next中使用picker.DocumentViewPicker()读取文件时报错E[picker] DocumentSelect documentSelectConfig: {“action”:"ohos.want.action.
const documentSelectOptions = new picker.DocumentSelectOptions();
documentSelectOptions.maxSelectNumber = 1;
documentSelectOptions.fileSuffixFilters = ['.pdf'];
const documentViewPicker = new picker.DocumentViewPicker();
documentViewPicker.select(documentSelectOptions)
.then((documentSelectResult: Array<string>) => {
let uriArr: Array<string> = documentSelectResult
callBack(uriArr)
})
.catch((err: BusinessError) => {
LogUtil.error(TAG, `Invoke documentPicker.select failed, code is ${err.code}, message is ${err.message}`);
})
控制台每次都会报如下错误:
I [picker] document select config: {“action”:“ohos.want.action.OPEN_FILE_SERVICE”,“parameters”:{“startMode”:“choose”,“extType”:“filePicker”,“pickerType”:“select”,“key_select_mode”:0,“key_pick_num”:1,“key_file_suffix_filter”:[".pdf"]}}
E [picker] DocumentSelect documentSelectConfig: {“action”:“ohos.want.action.OPEN_FILE_SERVICE”,“parameters”:{“startMode”:“choose”,“extType”:“filePicker”,“pickerType”:“select”,“key_select_mode”:0,“key_pick_num”:1,“key_file_suffix_filter”:[".pdf"]}}
更多关于HarmonyOS鸿蒙Next中使用picker.DocumentViewPicker()读取文件时报错E[picker] DocumentSelect documentSelectConfig: {"action":"ohos.want.action.的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在HarmonyOS鸿蒙Next中使用picker.DocumentViewPicker()读取文件时,报错E[picker] DocumentSelect documentSelectConfig: {"action":"ohos.want.action.,通常是因为配置参数不正确或权限问题。首先,确保在config.json中正确声明了ohos.permission.READ_MEDIA权限。其次,检查DocumentViewPicker的配置参数是否正确,特别是action字段,应设置为ohos.want.action.OPEN_DOCUMENT或其他有效的action值。此外,确保文件路径和类型符合系统要求。如果问题依旧,可能涉及系统兼容性或API版本问题,需进一步排查。
更多关于HarmonyOS鸿蒙Next中使用picker.DocumentViewPicker()读取文件时报错E[picker] DocumentSelect documentSelectConfig: {"action":"ohos.want.action.的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
在HarmonyOS鸿蒙Next中,使用picker.DocumentViewPicker()读取文件时,报错E[picker] DocumentSelect documentSelectConfig: {"action":"ohos.want.action."},通常是由于配置参数不正确或权限问题导致的。请检查以下几点:
- 权限配置:确保在
config.json中已声明ohos.permission.READ_MEDIA等必要权限。 - 参数正确性:检查
DocumentViewPicker的配置参数,确保action字段正确设置为"ohos.want.action.OPEN_DOCUMENT"。 - 系统版本:确认设备运行的HarmonyOS版本支持该API。
若问题仍未解决,建议查阅官方文档或社区获取更多帮助。

