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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:34:46+00:00 2026-06-15T14:34:46+00:00

in my app i have some NSOperation that update some core data element from

  • 0

in my app i have some NSOperation that update some core data element from a online database, sometime the update require some minute, and when the screen of iPhone lock, the app enter in the background mode, and this update is stopped, so i have to reopen the app to continue the update, so i have asked this some minute ago on SO, i have received this correct answer:

- (void)someMethodToKeepRunningInBackground {
UIBackgroundTaskIdentifier taskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(void) {
    // Uh-oh - we took too long. Stop task.
}];

// Perform task here
CheckForUpdate *checkUpdate = [[CheckForUpdate alloc] init];
[sectionCheckUpdateQueue addOperation:checkUpdate];       

if (taskId != UIBackgroundTaskInvalid) {
    [[UIApplication sharedApplication] endBackgroundTask:taskId];
}
}

the problem is that i have the more NSOperationQueue that run to perform the update, the sectionCheckUpdateQueue that i write above, that if found update schedule more NSOperation on other NSOperationQueue, so i can’t call this:

endBackgroundTask:taskId

because i don’t know when this NSOperationQueue are finished, so my question is, so how i can detect when this NSOperationQueue are finished so to call the endBacgkround:taskId?

  • 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-15T14:34:47+00:00Added an answer on June 15, 2026 at 2:34 pm

    You could call waitUntilAllOperationsAreFinished on the NSOperationQueue to know when it is done with all operations.

    https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSOperationQueue_class/Reference/Reference.html#//apple_ref/occ/instm/NSOperationQueue/waitUntilAllOperationsAreFinished

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

Sidebar

Related Questions

in my app i have some NSOperation that update some core data element from
I have some classes in my app that don't require an ID to be
In my app i have some interactive widgets but while loading data from server
I have some things in my app that I need to store, in order
In my ExtJS 4.0.7 app I have some 3rd party javascripts that I need
in my app I have some sprites that i need to drag and drop
Let's say in a Rails app you have some gems that you use in
I have an iPhone app I have developed that I want to have some
I have an app which downloads some files from the server in few threads.
In my android app I have some buttons, that should work with onTouch() method,

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.