Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:43:38+00:00 2026-06-16T00:43:38+00:00

I am doing some processing when the app enters the background state, I have

  • 0

I am doing some processing when the app enters the background state, I have put it under the beginBackgroundTaskWithExpirationHandler() and thereby, should be allotted ten minutes for the same. However, I believe the app is being suspended before that. The task I am performing is memory and CPU-intensive, so is it possible that the OS is putting my app to suspend state ?
If so, is there any way to bypass these restrictions. (I am open to using private API’s).

Here is the code for starting the background task:

   if([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]){

        if([[UIDevice currentDevice] isMultitaskingSupported]){
            __block UIBackgroundTaskIdentifier bgTask;
            UIApplication *application = [UIApplication sharedApplication];
            bgTask = [application beginBackgroundTaskWithExpirationHandler:^{

                    [application endBackgroundTask:bgTask];
                    bgTask = UIBackgroundTaskInvalid;
            }];

            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                [self captureImage];
                [application endBackgroundTask:bgTask];
                bgTask = UIBackgroundTaskInvalid;
            });
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:43:38+00:00Added an answer on June 16, 2026 at 12:43 am

    I am not sure that Daij-Dan is completely right.

    This part I agree with him:

    the os may kill you at any time when its pressured.
    

    However word “pressured” is quite vague. And I believe there should be a lot of pressure (low memory as example) to suspend app which legitimately requested more time. On one hand, it’s a real scenario case. On other hand, it’s happening not that often (iOS devices have quite a lot of memory nowdays).

    From documentation (http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html):

    Each call to this method must be balanced by a matching call to the endBackgroundTask:
    method. Applications running background tasks have a finite amount of time in which to run them. (You can find out how much time is available using the backgroundTimeRemaining property.) If you do not call endBackgroundTask: for each task before time expires, the system kills the application. If you provide a block object in the handler parameter, the system calls your handler before time expires to give you a chance to end the task.

    I would recommend:

    • Add some logs in completion handler
    • Add logs to the logs with logic (including backgroundTimeremaining)

    And if your app got suspended review system console logs.

    P.S. I removed iphone-privateapi tag, since it’s public API.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a app that is doing some video processing. I need to analyze
I have a background thread doing some processing, and saving to Core Data. In
i am doing some processing in the background in my app and i am
I have created a custom queue where I am doing some processing and thereby
I have a web application that will be doing some processing with submitted data.
I basically have a unix process running and it is doing some heavy processing
I'm doing some work on an image processing app (for fun) and am struggling
My app ends up doing a lot of background processing via Actors, specifically loading
For my app, I have about 15Mb (which can be compressed with some processing
I'm doing some processing on some very large video files (often up to 16MP),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.