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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:25:30+00:00 2026-05-28T07:25:30+00:00

Im developing an app that has to run in the background. It’s a location

  • 0

Im developing an app that has to run in the background. It’s a location based app, so it runs all the time, the OS doesn’t kill it.

It should send some info every 10 secs(just for debugging), I set a timer once its in the background. I set a breakpoint in the function that should be executed every 10 secs, which is never called, but if I pause the app and then continue the timer is called, and then the timer is executed every 10 secs without problems, weird right?

I thought that the timer would be executing anyway when I wasn’t debugging, but it isn’t, same thing as if I didn’t pause the debugging.

My question is WHY?? The timer is set correctly(I assume) since it works after pausing, but it’s not.

Any ideas?

The way I set the timer is:

self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(doStuff) userInfo:nil repeats:YES];

And in the function I connect to a webservice.

Thanks.

  • 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-28T07:25:30+00:00Added an answer on May 28, 2026 at 7:25 am

    I have a similar app design and was stuck on the same thing. What I found somewhere on the internet is adding this type of statement applicationDidEnterBackground:

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

    This tells the os that you still have things going and not to stop it.

    I have my timer attached to this function

     //this is a wrapper method to fit the required selector signature
    - (void)timeIntervalEnded:(NSTimer*)timer {
         [self writeToLog:[NSString stringWithFormat:@"Timer Ended On %@",[NSDate date]]];
         [self startReadingLocation];
         [timer invalidate];
         timer=nil;
    }
    

    I set the timer in my my location manager delegate methods.

    I feel your pain. I found that these things were super finicky. This is what worked for me. I hope it helps. I have found that there isn’t any really restrictions in what you can do in the background.

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

Sidebar

Related Questions

Background: As I'm developing an app that needs to be run on a device,
I'm developing an iPhone app that has a network component. I'm developing the app
When developing an app that will listen on a TCP/IP port, how should one
I am developing an iPhone app that displays several views, all acessed via Tab
I'm developing an iPhone app that features a tab-bar based navigation with five tabs.
I am developing an app for android that has to access another class, but
So I'm developing in Xcode for iOS, and EVERY APP that I run in
i'm developing an app that make requests to the Musicbrainz webservice. I read in
I'm developing web app that user can save his/her work to server. The data
I'm developing an app that checks several conditions during an incoming phone call. 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.