Continue uploading process in background IOS

后端 未结 4 1242
一向
一向 2020-12-09 01:02

I was wondering if it was possible to continue the uploading of a file in the background. for example when the user puts the iPad in sleep, the uploading continues...

<
相关标签:
4条回答
  • 2020-12-09 01:13

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html

    By requesting, it means that when your App Delegate method applicationDidEnterBackground gets called you have about 5 seconds to finish up. As you are doing a long upload, you can request additional time via beginBackgroundTaskWithExpirationHandler

    0 讨论(0)
  • 2020-12-09 01:16

    New Dropbox SDK provides the functionality of background uploading/Downloading of files. Please try using new SDK. Have a happy coding.

    0 讨论(0)
  • 2020-12-09 01:26

    You need to ask the OS to keep the app running, it has nothing to do with Dropbox... When you start uploading, do this:

    UIBackgroundTaskIdentifier bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        [[UIApplication sharedApplication] endBackgroundTask:bgTask];
    }];
    

    ... and store the bgTask somewhere. Then when your upload completes or fails, do this:

    [[UIApplication sharedApplication] endBackgroundTask:bgTask];
    

    That will tell the OS to keep your app running because there's a background task running...

    0 讨论(0)
  • 2020-12-09 01:26

    I guess this worked for me.

    1. disabled autolock
    2. disabled screentimeout
    3. plugged in to power
    4. Enable location services on iphone for dropbox and background running option
    5. left the dropbox app open
    6. more than 2000 photos & videos upload successfully
    0 讨论(0)
提交回复
热议问题