react-native-fetch-blob icon indicating copy to clipboard operation
react-native-fetch-blob copied to clipboard

iOS - Terminated when entering background even when requests were canceled

Open lequanghuylc opened this issue 7 years ago • 10 comments

I'm using RN 0.42 and notice that my app has always been terminated after entering background a few minutes. My app got terminated when: +, API request calls using RNFetchBlob +, download large files, even cancel request before entering background.

It just happens whenever I use RNFetchBlob. The memory is fine and things go back to normal when I comment RNFetchBlob code blocks or use the usual fetch. Does anybody know why?

lequanghuylc avatar Mar 28 '17 07:03 lequanghuylc

@lequanghuylc , thanks for reporting this issue. We've applied a fix but it's not published yet.

You can install the package from branch issue-271

$ npm install --save git://github.com/wkh237/react-native-fetch-blob.git#issue-271

refer to #271

wkh237 avatar Mar 28 '17 08:03 wkh237

@wkh237 the branch issue-271 comments the line [app endBackgroundTask:tid]; and It's still the same. But I comment the whole UIBackgroundTaskIdentifier code blocks and it seems OK now.

lequanghuylc avatar Mar 28 '17 11:03 lequanghuylc

@lequanghuylc , thanks for the feedback. Will keep work on this issue and see if there's a better solution. Otherwise, we can temporarily disable this feature.

wkh237 avatar Mar 28 '17 14:03 wkh237

@lequanghuylc I've updated IOS background task implementation to branch issue-301, please upgrade the package see if that works, thanks !

wkh237 avatar Mar 29 '17 02:03 wkh237

@wkh237, thanks for your quick response. I thought it'll be a while :D. I tried it out and It didn't work. I installed the branch issue-301, (npm install --save git://github.com/wkh237/react-native-fetch-blob.git#issue-301) and built the project, but it's still terminated in background. Have to comment the blocks again.

lequanghuylc avatar Apr 03 '17 05:04 lequanghuylc

I've some production logs with

"RCTFatalException: Exception '-[UILayoutContainerView bridge]: unrecognized selector sent to instance 0x10051b3b0' was thrown while invoking emitExpiredEvent on target RNFetchBlob with params (\n 277\n)

But I can't reproduce this issue. In my app, I can download small files ~50Mo max. Even if I simulate a very bad network, put my app in background and wait (as the OP issue), it goes well.

Is there a way to reproduce it? If yes, I can try the fix

Crash-- avatar May 22 '17 08:05 Crash--

I'm seeing this same crash. Is there any update on this? I'm using react-native-fetch-blog 0.10.4 included through a dependency of another library. I'm wondering if upgrading to 0.10.6 will help?

jbolter avatar Aug 01 '17 23:08 jbolter

This is what I got, not sure if it's the same:

RCTFatalException: Exception '-[UIView bridge]: unrecognized selector sent to instance 0x107d54840' was thrown while invoking emitExpiredEvent on target RNFetchBlob with params (
    51533
) Exception '-[UIView bridge]: unrecognized selector sent to instance 0x107d5... 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation +[NSException raise:format:]
    /tmp/sandbox/workspace/node_modules/react-native/React/Base/RCTAssert.m:134:7 RCTFatal
    /tmp/sandbox/workspace/node_modules/react-native/React/CxxModule/RCTNativeModule.mm:107:5 invokeInner
    /tmp/sandbox/workspace/node_modules/react-native/React/CxxModule/RCTNativeModule.mm:67:5 operator()
    /usr/lib/system/libdispatch.dylib __dispatch_call_block_and_release
    /usr/lib/system/libdispatch.dylib __dispatch_client_callout
    /usr/lib/system/libdispatch.dylib __dispatch_queue_serial_drain
    /usr/lib/system/libdispatch.dylib __dispatch_queue_invoke
    /usr/lib/system/libdispatch.dylib __dispatch_queue_override_invoke
    /usr/lib/system/libdispatch.dylib __dispatch_root_queue_drain
    /usr/lib/system/libdispatch.dylib __dispatch_worker_thread3
    /usr/lib/system/libsystem_pthread.dylib __pthread_wqthread
    /usr/lib/system/libsystem_pthread.dylib _start_wqthread

SudoPlz avatar Sep 18 '17 22:09 SudoPlz

Hey guys! Is this issue fixed the latest release 0.10.8? Or should I continue using the following solutions? npm install --save git://github.com/wkh237/react-native-fetch-blob.git#issue-271

cfontana0 avatar May 15 '18 16:05 cfontana0

Hi guys, Is there any forecast when this issue will be merged with release?

othondev avatar Nov 13 '18 12:11 othondev