Search code examples
iosxcodebackgroundbackground-process

iOS - How to keep application running in background


i am facing some serious problem while uploading a file in background mode to a FTP server,

i am having 180 seconds to accomplish this and i am using this code to keep application alive in background within ApplicationDidEnterBackGround

_backgroundIdentifier = [[UIApplication sharedApplication]beginBackgroundTaskWithName:@"BackGroundTask" expirationHandler:^{
_backgroundIdentifier = UIBackGroundTaskInvalid;
}];

please help me out in this, this give me only 180 seconds, and if my application takes more time to upload the file iOS don't allow that. what else i can do? Thanks in advance.


Solution

  • Got the answer, From iOS 7 and later background execution time for any application is only 180 seconds. i.e you have only 3 minutes if you are not using any background facility like voip or CLLocation etc.