Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Introduce pattern for cleaner transition to background #115

Closed
SamSaffron opened this issue Aug 30, 2016 · 7 comments
Closed

Introduce pattern for cleaner transition to background #115

SamSaffron opened this issue Aug 30, 2016 · 7 comments

Comments

@SamSaffron
Copy link

Per: http://stackoverflow.com/a/10319761/17174

When app transitions to background native blob should provide the hooks to extend execution until all downloads are complete (or properly timed out)

@wkh237
Copy link
Owner

wkh237 commented Aug 31, 2016

@SamSaffron , Thanks for your information, I think this is a very improtant feature, and we've tried to implent background transmission mechanism, but it's not an easy task, perhaps still need some time.

@SamSaffron
Copy link
Author

Recently I have been fighting super hard to get background fetch going. It seems discourse/DiscourseMobile@989c3a3 may have done the trick but it took me days of debugging and I am still not certain.

Cleanly dealing with transition to background is a great feature for RN to have, I will raise a separate ticket so core react networking networking deals with this as well

@wkh237
Copy link
Owner

wkh237 commented Aug 31, 2016

Yeah, I'm agree with you. On Android, developer can use Download Manager but there's no such a solution on IOS.

It would be great to have this implemented, I'll look into it 👍

@SamSaffron
Copy link
Author

I also opened this issue now to see if core should add something facebook/react-native#9678

wkh237 added a commit that referenced this issue Sep 17, 2016
@wkh237
Copy link
Owner

wkh237 commented Sep 23, 2016

related #141

wkh237 added a commit that referenced this issue Oct 12, 2016
@wkh237 wkh237 added the beta label Oct 12, 2016
wkh237 added a commit that referenced this issue Nov 2, 2016
@wkh237
Copy link
Owner

wkh237 commented Nov 3, 2016

@SamSaffron , I've added fetch.expire() API so that you can handle expired request. Please try upgrade 0.10.0-beta.5 from npm if needed, thank you 😄

Document and example

@wkh237 wkh237 closed this as completed Nov 9, 2016
@eds101
Copy link

eds101 commented Feb 18, 2017

Hi guys,

This issue/PR is causing my app to be killed by iOS after 3 minutes in the background.

Specifically, if I comment out these lines, the problem goes away:

    // #115 handling task expired when application entering backgound for a long time
    UIBackgroundTaskIdentifier tid = [app beginBackgroundTaskWithName:taskId expirationHandler:^{
        NSLog([NSString stringWithFormat:@"session %@ expired", taskId ]);
        [expirationTable setObject:task forKey:taskId];
        [app endBackgroundTask:tid];
    }];

This is the error message I see in the Xcode console after ~3 mins in the background:

 session 3497b1e7—adf9—kéd1—b94c—f933c992eb61 expired
 can't endBackgroundTask: no background task exists with identifier 16e12b9e9, or it may have already ended. Break in UIApplicationEndBackgroundTaskError() to debug.

This is a big problem for our users -- three minutes is a very short time!

Any ideas?

We are on version 0.10.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants