ios - 打开相机时应用程序崩溃
问题描述
我在我的应用程序中使用https://github.com/ivpusic/react-native-image-crop-picker,当相机打开时我可以拍照,但是当我想选择它时,应用程序崩溃了,有时它崩溃了一次相机已打开,但是当我使用调试模式而不是在 android 上运行时,它在所有情况下都运行良好。
当我从 xcode 运行项目时工作正常,但不适用于 react-native run-ios --device "myDeviceName"
也有更高版本的 ios 像 13 它运行良好
- react-native-image-crop-picker ^0.23.1
- 反应原生 v0.59.0
- IOS 9.3.6
我调用打开相机时的组件:
ImagePicker.openCamera({
cropping: true,
width: 500,
height: 500,
includeExif: true,
includeBase64: true,
mediaType:"photo"
})
.then(image => {
this.setState({
cameraOpened: false
});
this.props.navigation.navigate("Preview", {
picture: image,
type: this.type,
state: this.props.navigation.state,
userId: this.userId
});
})
.catch(e => {
console.log(e);
this.setState({
cameraOpened: false
});
this.props.navigation.goBack();
});
}
预览.js:
ImageEditor.cropImage(
this.picture.path,
{
offset: { x: 0, y: 0 },
size: { width: 500, height: 500 },
displaySize: { width: 500, height: 500 }
},
res => {
// Change it to res
this._uploadPicture(this.picture.path, response => {
if (response.status == 200) {
this.props.savePicture(this.picture);
this.setState(
{
loading: false
},
() => {
this.navigation.goBack(key);
}
);
} else {
alert(response);
}
});
},
err => {
this.setState({
loading: false
});
alert(err);
}
);
任何想法 ?谢谢
解决方案
稍后,但对于期货搜索者:
我遇到了同样的问题,即使在 Info.plist 中添加了
NSPhotoLibraryAddUsageDescription
, NSPhotoLibraryUsageDescription
, NSMicrophoneUsageDescription
, NSCameraUsageDescription
,我还是收到了来自 Apple Store connect 的电子邮件,内容是“Info.plist 中缺少目的字符串”。
这次我错过了“NSAppleMusicUsageDescription”。我不确定为什么我需要这个属性,因为我的应用程序中没有音乐,但它对我有用。
推荐阅读
- javascript - 使用 viv.time 库中的 Bixby DateTimeExpressions 时,是否有关于特定时间范围的文档?
- c++ - 如何防止 QScroller 手势干扰 QGraphicsView 拖动模式?
- javascript - 在 HTML 和 javascript 中显示内容时如何强制换行
- c# - Kestrel 使用控制器方法返回 404 错误
- php - 在另一个类的上下文中将类型解析为其完全限定的类名(仅通过其名称)
- pandas - 如何通过检查包含在单元格元素中的列表来过滤 Pandas DataFrame 行?
- python - 从python中的数组中提取值
- node.js - 读写大文件时Node.js内存泄漏
- mysql - MySQL 中的子咨询
- splunk - splunk join 2 搜索查询