dcloudio / dcloudio/native-docs

Android 集成uni小程序 chooseImage无效问题

Open
#106 0 comments 0 reactions 1 assignee Claimed by @ArrayDC View on GitHub
Dominant language
No language data
Stars
88
Forks
75
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
使用uni小程序SDK开发集成到Android上后chooseImage无法调起相机

**复现步骤**
1. 创建拍照按钮组件
2. 点击按钮,调用chooseImage方法调起相机,在iOS上正常,Android上无响应

```js
pickImage() {
const that = this
uni.chooseImage({
count: 1,
sourceType: ['camera'],
success({ tempFilePaths }) {
if (that.isSaveLocal) { // 需要保存到本地
uni.saveFile({
tempFilePath: tempFilePaths[0],
success({ savedFilePath }) {
that.list.push(savedFilePath)
that.$emit('add-image', savedFilePath)
},
fail() {
uni.showToast({
icon: 'none',
title: '保存本机失败,请查看是否有权限',
})
}
})
} else {
that.list.push(tempFilePaths[0])
that.$emit('add-image', tempFilePaths[0])
}
}
})
}
```

**预期结果**
正常调起相机拍照

**实际结果**
iOS调用一切正常
Android无响应

**系统信息:**
- 发行平台: uni小程序嵌入到原生项目
- 操作系统: Android 10
- HBuilderX版本 3.1.8
- uni-app版本 [如使用Vue-cli创建/运行项目,则提供`npm run info`的运行结果]
- 设备信息 XiaoMi10 plus

**补充信息**
Android上调用扫码功能是正常的,也就是说相机是可以调用的,并且下载安装Android打包的安装包后第一次调用chooseImage方法是会提示用户是否授予相机权限的,但是授予权限后没有反应,再次点击拍照调用chooseImage也无响应

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.