Closed QAZDER closed 3 years ago
Well its returning a promise, so you should probably have RNFetchBlob.fetch(...).then(...)
or use async/await. If you're not awaiting the promise its possible that it never does its work properly without an await.
Thanks for the reply. But I don't think this error is caused by async/await cause this error only happens when bodydata is an array, while it works fine when bodydata is an object.
finally solved
@QAZDER what was the solution?
Hi, when using RNFetch.fetch to upload images which selected by react-native-image-picke, it got an error on ios: The network connection was lost. it works fine on android.
is there any config i didn't add to header? thanks in advance!
here is my code:
Version:
XCode Log
2020-08-04 13:30:03.115101+0800 XXX[70713:34342226] [] nw_socket_handle_socket_event [C25.1:2] Socket SO_ERROR [54: Connection reset by peer] 2020-08-04 13:30:03.115550+0800 XXX[70713:34342226] [] nw_read_request_report [C25] Receive failed with error "Connection reset by peer" 2020-08-04 13:30:03.115980+0800 XXX[70713:34342226] [] nw_socket_output_finished [C25.1:2] shutdown(26, SHUT_WR) [57: Socket is not connected] 2020-08-04 13:30:03.121374+0800 XXX[70713:34342226] Task <2FD0F2E3-80B4-4312-80D6-4C29B512ADE4>.<1> HTTP load failed, 231630/50 bytes (error code: -1005 [4:-4]) 2020-08-04 13:30:03.124174+0800 XXX[70713:34342226] Task <2FD0F2E3-80B4-4312-80D6-4C29B512ADE4>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x600002a1c120 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey={length = 16, capacity = 16, bytes = 0x10021f90c0a80a400000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <2FD0F2E3-80B4-4312-80D6-4C29B512ADE4>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <2FD0F2E3-80B4-4312-80D6-4C29B512ADE4>.<1>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=XXX, NSErrorFailingURLKey=XXX, _kCFStreamErrorDomainKey=4