openim-sdk-core
openim-sdk-core copied to clipboard
Sending image messages fails for flutter ios
What happened?
We are having some issues whereby sending images fails for flutter IOS but works for Android.
What did you expect to happen?
we expected the image to be send to the recipient of the chat.
How can we reproduce it (as minimally and precisely as possible)?
Message message =
await OpenIM.iMManager.messageManager.createImageMessageFromFullPath(
// imagePath: "{}",
imagePath: image.path);
var apath = (await getApplicationDocumentsDirectory()).path;
final success = await OpenIM.iMManager.initSDK(
platformID: Platform.isIOS ? 1 : 2,
apiAddr: 'https://gallics.app:8443/chat',
wsAddr: 'wss://gallics.app:8443/chat/msg_gateway',
dataDir: apath, // 数据存储路径。如:
objectStorage: 'cos', // 图片服务器默认'cos'
logLevel: 6, // 日志等级,默认值6
listener: OnConnectListener(
onConnectSuccess: () {
// 已经成功连接到服务器
},
onConnecting: () {
// 正在连接到服务器,适合在 UI 上展示“正在连接”状态。
},
onConnectFailed: (code, errorMsg) {
// 连接服务器失败,可以提示用户当前网络连接不可用
},
onKickedOffline: () {
// 当前用户被踢下线,此时可以 UI 提示用户“您已经在其他端登录了当前账号,是否重新登录?”
},
),
);
Anything else we need to know?
we used image_picker-1.0.4 which can be found on pub to get our images from Ios and Andriod , and then pass the path to openIM.
https://pub.dev/packages/image_picker
version
Cloud provider
OS version
Install tools
@script-neutron hi, Is there more exception information? Start with the call to "createImageMessageFromFullPath".
not really any more exceptions , i added the only available message
any update ?
- what version of SDK are you using?
- Can you go to the sandbox and see if this file really exists?
- All logs that call "createImageMessageFromFullPath" to send messages will be copied here.
SDK 3.3.0
[open_im_sdk/util.go:247] input req {"operationID": "1699005205439", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(*Conversation).CreateImageMessageFromFullPath-fm", "args": ["/private/var/mobile/Containers/Data/Application/7745E110-07AA-491A-B6DB-1960C5FE9C31/tmp/image_picker_0660E814-E41E-4E89-8FD5-358EF6285908-58964-0000181BD5432AFF.jpg"]}
fnv: 0x1007850a0 ins: [<*context.valueCtx Value> /private/var/mobile/Containers/Data/Application/7745E110-07AA-491A-B6DB-1960C5FE9C31/tmp/image_picker_0660E814-E41E-4E89-8FD5-358EF6285908-58964-0000181BD5432AFF.jpg]
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Unexpected end of input (at character 1)
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
openimsdk/open-im-server#1 _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:501:7)
openimsdk/open-im-server#2 _parseJson (dart:convert-patch/convert_patch.dart:36:10)
openimsdk/open-im-server#3 JsonDecoder.convert (dart:convert/json.dart:610:36)
openimsdk/open-im-server#4 JsonCodec.decode (dart:convert/json.dart:216:41)
openimsdk/open-im-server#5 jsonDecode (dart:convert/json.dart:155:10)
openimsdk/open-im-server#6 Utils.formatJson (package:flutter_openim_sdk/src/utils.dart:12:46)
openimsdk/open-im-server#7 Utils.toObj (package:flutter_openim_sdk/src/utils.dart:8:9)
openimsdk/open-im-server#8 MessageManager.createImageMessageFromFullPath.<anonymous closure> (package:flutter_openim_sdk/src/manager/im_message_manager.dart:232:34)
<asynchronous suspension>
Will the demo run correctly on your iPhone? And use Flutter SDK 3.7.12
https://github.com/openimsdk/open-im-flutter-demo
ok am going to try and see
I have the same question, any update ?
@script-neutron @abel-wang-git hi,
"dataDir: apath,"
this input parameter needs to end with "/".
like this:
"dataDir: xx/xx/"
/invite
The latest version doesn't have this issue. Please go ahead and use it.