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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:06:36+00:00 2026-05-25T16:06:36+00:00

I create an NSOperation every time my app launches or resigns active. I need

  • 0

I create an NSOperation every time my app launches or resigns active. I need to queue them with dependencies such that two never execute at the same time, but one after another.

Is it safe to do this?

  • Hold a strong reference to the NSOperation object in the App Delegate.
  • When the app resigns active, simply check if hat property is not nil.
  • If it is not nil, check if the current NSOperation -isFinished.
  • If it’s finished, just add the new one to the queue.
  • If it’s not finished yet, create the new one and set a dependency on the running one, then add it to the queue.

I’m concerned a bit with multithreading issues here. The documentation of the -isFinished or -addDependency: methods doesn’t say they should not be called from the main thread. So I guess it is ok to do that.

Edit: The NSOperation performs some file system operations in the background.

  • 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-25T16:06:37+00:00Added an answer on May 25, 2026 at 4:06 pm

    If you want to ensure they are not called at the same time, set the maximumConcurrentOperationCount: on your NSOperationQueue to 1.

    - (void)setMaxConcurrentOperationCount:(NSInteger)count
    

    This assumes you are putting both of your NSOperations in the same queue.

    In response to your other questions. I’m not sure what you are doing – but yes you can hold strong a reference to your NSOperation on the AppDelegate if you want, and you can check isFinished

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

Sidebar

Related Questions

I created an NSOperation. Do I also need to create an autorelease pool for
I'm about to create a series of NSOperation s and run them in a
Create Pex test to test a DLL and hardware controlled by that DLL? I
In an iPad app I'm developing, I need to put the network handling on
I am currently writing an App that needs the ability to modify and persist
I have a launchd daemon that every so often uploads some data via a
So I am trying to create a check that tries to connect to the
I have an app that makes SOAP calls. To keep the UI from blocking,
I need to use Core Data inside NSOperationQueue operations. I've heard that it's sufficient
I'm currently working with an NSPersistentDocument subclass that uses NSOperation to import data in

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.