[BUG] Sending high-resolution images causes the app to crash
OpenIM Server Version
3.8.0
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Docker Deployment
Bug Description and Steps to Reproduce
const selectImage = async () => {
// 请求访问媒体库的权限
const { granted } = await requestMediaLibraryPermissionsAsync();
if (!granted) {
Alert.alert('Permissions denied!');
return;
}
// 打开图片库
const resp = await launchImageLibraryAsync({
mediaTypes: MediaTypeOptions.Images,
allowsMultipleSelection: false,
selectionLimit: 1,
quality: 0.75, // 保持高质量,但后续我们会进行压缩
});
if (resp.canceled) {
return;
}
if (resp.assets && resp.assets.length > 0) {
let { uri } = resp.assets[0];
if (uri) {
if (uri.startsWith('file://')) {
uri = uri.substring(7);
}
// 创建图片消息并发送
const message = await OpenIMSDKRN.createImageMessageFromFullPath(uri, uuidv4());
sendMessage({ message });
}
}
};
Screenshots Link
No response
quality can not set 1 or 0.9
If you choose a high-resolution image, what might go wrong? Can you locate the specific function?
When executing this line : const successMessage = await OpenIMSDKRN.sendMessage(options, uuidv4());
这个问题解决了吗?
我有个一样的问题,发送图片消息必然崩溃,反复测试过:与压缩,和图片大小应该是没有关系的。比如发送1M 以及压缩至100KB ,发送都会崩溃。 目前我的解决方案是通过OpenIMSDKRN.uploadFile先上传,再通过OpenIMSDKRN.sendMessage发送图片消息。但这个方案无法读取进度条。期待尽快解决!
@OrrinHatch 谢谢。。
@daxingyun 或者 在这个文件 https://github.com/openimsdk/open-im-sdk-reactnative/blob/main/android/src/main/java/com/openimsdkrn/SendMsgCallBack.java
@OrrinHatch 我的问题似乎已经解决了,我修改的代码:params.putMap("message", Arguments.makeNativeMap(message.toHashMap())); ,copy()是不存在的函数。谢谢。。。