'react-native-image-picker'允许选择图像,即使在照片库权限被拒绝后



当Photo Library"允许提示&拒绝了。

仍然可以打开图书馆&在iOS中选择图片

测试于iOS版本:15.5

依赖使用:

"react-native-image-picker": "^4.8.3"

这是我的代码。

import { launchImageLibrary } from "react-native-image-picker";
launchImageLibrary(
{
mediaType: "photo",
quality: 0.6,
includeBase64: true
},
response => {
console.log("Response = ", response);
if (response.didCancel) {
console.log("User cancelled image picker");
alert("User cancelled image picker");
} else if (response.errorCode) {
console.log("ImagePicker ErrorCode: ", response.errorCode);
alert("ImagePicker ErrorCode: " + response.errorCode);
} else if (response.errorMessage) {
console.log("ImagePicker ErrorMessage: ", response.errorMessage);
alert("ImagePicker ErrorMessage: " + response.errorMessage);
} else {
let source = response;
const uri = response?.assets && response.assets[0].uri;
const base64 = response?.assets && response.assets[0].base64;
const fileSize = response?.assets && response.assets[0].fileSize;
console.log("uri: ", uri);
console.log("base64: ", base64);
console.log("fileSize: ", (fileSize / (1024 * 1024)).toFixed(2), "MB");
}
}
);

为什么会发生这种情况?是否有人成功提交了&通过AppStore审核了吗?有可能被拒绝吗?

权限只适用于android,对于IOS,你的方法是正确的,应用商店不会拒绝你的应用,但在android,你的代码不起作用。

相关内容

  • 没有找到相关文章

最新更新