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 7537317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:49:10+00:00 2026-05-30T06:49:10+00:00

I am working with iphone background process in my application. it is running in

  • 0

I am working with iphone background process in my application. it is running in background but after 10 min it is terminating my application. And not working for long time.

My application contains 1 counter with timmer when viewdidload at that time my counter will start and when i will click on home button it will run in the background. In background it is running perfect but after 10 min it is stoping my background process. Following is my code for it.

in .h file.

IBOutlet UILabel *thecount;
int count;
NSTimer *theTimer;
UIBackgroundTaskIdentifier counterTask;

in my .m

- (void)viewDidLoad {

    UIBackgroundTaskIdentifier bgTask = nil;
    UIApplication  *app = [UIApplication sharedApplication];


    counterTask = [[UIApplication sharedApplication]
                   beginBackgroundTaskWithExpirationHandler:^{
                       [app endBackgroundTask:counterTask]; 
                       //counterTask = UIBackgroundTaskInvalid;

                       // If you're worried about exceeding 10 minutes, handle it here
                       theTimer=[NSTimer scheduledTimerWithTimeInterval:0.5
                                                                 target:self
                                                               selector:@selector(countUp)
                                                               userInfo:nil
                                                                repeats:YES];
                   }];

    count=0;
    theTimer=[NSTimer scheduledTimerWithTimeInterval:0.5
                         target:self
                         selector:@selector(countUp)
                         userInfo:nil
                         repeats:YES];

    [super viewDidLoad];
}
  • (void)countUp {

     count++;
     NSString *currentCount;
    
     currentCount=[[NSString alloc] initWithFormat:@"%d",count];
     NSLog(@"timer running in background :%@",currentCount);
     thecount.text=currentCount;
     [currentCount release];
    

}

The above code just sample to count number foreground and background. but after 10 min it is not working.

So please help me and provide me some help for it.

  • 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-05-30T06:49:11+00:00Added an answer on May 30, 2026 at 6:49 am

    10 minutes is the maximum you get for long-running background tasks. iOS doesn’t promote the idea of long-running background processes and for the sake for your user, you shouldn’t try to do them.

    In order to have your code running for longer than that, some other external events may make your app be woken up again or be kept running, e.g. GPS location events, playing audio or incoming VoIP connections in your VoIP-type app.

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

Sidebar

Related Questions

I'm working on an iphone application (not web app) and I'd like to build
I'm working on an iPhone application which will use long-polling to send event notifications
Please check out the screenshots, Its working ok in ipad but not in iphone/iphone4.
I am working on Iphone application and new to dev. I am sorry if
I am working on iphone networking application.. I am using asihttp , a wrapper
I'm working on iphone application which needs to run offline at an exhibition. It
I am working on an iPhone Application that stores images in the Applications 'Document'
I'm working on an iPhone application. I have an object of class Row that
I'm working on an iphone app but this is probably a general question. I
I'm working on an application that will be available for Android and iPhone. The

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.