以下代码适用于expo,但在构建时不起作用。请帮助我。
_pickImage2 = async () => {
await Permissions.askAsync(Permissions.CAMERA);
await Permissions.askAsync(Permissions.CAMERA_ROLL);
let result = await ImagePicker.launchCameraAsync({
aspect: [4, 3],
quality: 1
});
if (!result.cancelled) {
var cr = this.state.count;
this.setState({ ["image"+cr]: result.uri });
var cn = this.state.count + 1;
this.setState({ count:cn });
}
};
答案 0 :(得分:0)
向app.json添加权限并重建apk
"android": {
"package": "com.company.someapp",
"permissions": [
"CAMERA",
"WRITE_EXTERNAL_STORAGE",
"READ_EXTERNAL_STORAGE"
]
}