Continue uploading process in background IOS

ε祈祈猫儿з 提交于 2019-11-28 07:04:45

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...

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

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

Somshkr

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!