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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:47:31+00:00 2026-06-17T14:47:31+00:00

Get notification when NSOperationQueue finishes all tasks I have the same issue as the

  • 0

Get notification when NSOperationQueue finishes all tasks

I have the same issue as the one posted by @porneL in the post above. I tried the solution posted by @NickForge (one that received 57 votes), but I am obviously doing it wrong because it does not work for me. Here is the problem setup and my implementation:

I need to start a spinner before kicking off a set of web-service operations, and stop the spinner when they are complete. The webservices are invoked through a shared AFHTTPClient instance (part of the AFNetworking package) which adds them to its NSOperationQueue.

I set up an observer in the ViewController from which the data loads are kicked off. Did this using the answer from the above post. Implementation in my VC looks like:

In my ViewController’s init method:

//add WelcomeVC as an observer for AFHTTPClient dataloadOps notifications
[[[MyCustomAFHTTPClient sharedClient] operationQueue] addObserver:self forKeyPath:@"DataLoaderEvent" options:0 context:NULL];

In my ViewController’s observeValueForKeyPath method:

- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if( (object == [[MyCustomAFHTTPClient sharedClient] operationQueue])
       && [keyPath isEqualToString:@"DataLoaderEvent"]) {

        if ( [[[MyCustomAFHTTPClient sharedClient] operationQueue] operationCount] == 0) {

            NSLog(@"EUREKA!!! QUEUE IS EMPTY! DATALOAD HAS COMPLETED!");
        }

    }
}

The ViewController’s observeValueForKeyPath method however never gets called!

Any help to get this working would be most appreciated so I can then complete implementing the spinner.

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

    Does operationQueue have a property called DataLoaderEvent? Normally one monitors the “operationCount” property of an NSOperationQueue.

    See http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/NSOperationQueue_class/Reference/Reference.html#//apple_ref/doc/uid/TP40004592

    “The NSOperationQueue class is key-value coding (KVC) and key-value observing (KVO) compliant. You can observe these properties as desired to control other parts of your application. The properties you can observe include the following:

    operations – read-only property

    operationCount – read-only property”

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

Sidebar

Related Questions

I want my program to get notification each time someone makes a post to
Is it possible to get notification when application entered fullscreen mode? Because I have
I'm developing an Eclipse plugin. I have been reading how to subscribe get notification
Is there a way to get notification of date change in c#? I have
I try to get notification when the Search button is clicked in the keyboard
The scenario is that a user should get notification (say via typical JS alert
I'm trying to get the notification NSTaskDidTerminateNotification in my multithreaded app but I can't
I get the following notification on many pages: Notice: Undefined variable: jump_link_target in include()
ist there a way to get a change notification if an attached property changed?
Is there a way to get a system notification when an app has been

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.