Open neilzhengzx opened 1 month ago
Open_im_sdk.createImageMessageFromFullPath(operationID, imagePath)
return empty cause JSON parse error.
pc web works well, only error in RN version.
What parameters did you pass in
in this project -> Footer.tsx -> selectImage , const message = await OpenIMSDKRN.createImageMessageFromFullPath(originalPath, "qwertyuiop");
It works fine on the emulator
{"clientMsgID": "abab7f7b32e5b0ab8558fd3e58b04afd", "contentType": 102, "createTime": 1717468074338, "isRead": false, "msgFrom": 100, "pictureElem": {"sourcePath": "/sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000000019.jpg", "sourcePicture": {"height": 1920, "size": 0, "type": "image/jpeg", "width": 1440}}, "sendID": "7733257624", "sendTime": 1717468074338, "senderNickname": "17500000001", "senderPlatformID": 2, "seq": 0, "sessionType": 0, "status": 1}
Verify the originalPath content when using the real machine
测试是权限未申请,修改后可以收到回调. 但图片稍大一点,app会崩溃:
try {
const granted = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
]);
if (
granted[PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE] === PermissionsAndroid.RESULTS.GRANTED &&
granted[PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE] === PermissionsAndroid.RESULTS.GRANTED
) {
const response = await launchImageLibrary({
mediaType: "photo",
selectionLimit: 1,
});
if (response.didCancel || response.errorCode) return;
if (response.assets && response.assets.length > 0) {
let { originalPath } = response.assets[0];
if (originalPath) {
const message = await OpenIMSDKRN.createImageMessageFromFullPath(originalPath, "qwertyuiop");
console.log("return message:" + message);
sendMessage({ message });
}
}
} else {
console.log("not allow permission");
}
} catch (err) {
console.log("cancel");
}
About how many MB?try to use Android Studio collect logs
image size 277kb: options: { "recvID": "6491348764", "groupID": "", "message": { "seq": 0, "contentType": 102, "clientMsgID": "0b486acaec2fd29270ddf5c210565df9", "senderFaceUrl": "https://*/api/object/6374389285/image_cropper_1717056293429.jpg", "sendTime": 1718095579317, "sendID": "6374389285", "senderPlatformID": 2, "isRead": false, "pictureElem": { "sourcePath": "/storage/emulated/0/Pictures/Screenshots/Screenshot_20240110_164848.jpg", "sourcePicture": { "height": 1600, "type": "image/jpeg", "width": 720, "size": 0 } }, "status": 1, "msgFrom": 100, "sessionType": 0, "createTime": 1718095579317, "senderNickname": "openimtest" } }
api: const successMessage = await OpenIMSDKRN.sendMessage(options, "opid");
err: { "nativeStackAndroid": [], "userInfo": null, "message": "500 invalid multipart upload id: unexpected end of JSON input invalid multipart upload id: unexpected end of JSON input", "code": "500" }
I have the same error!
error [Error: 500 ServerInternalError invalid multipart upload id: unexpected end of JSON input]
Have you fixed the error?
OpenIM Server Version
open-im-sdk-rn 3.5.1-rc.2
Operating System and CPU Architecture
macOS (ARM)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
new demo release String message = Open_im_sdk.createImageMessageFromFullPath(operationID, imagePath); message get ""
Screenshots Link
No response