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

  • Home
  • SEARCH
  • 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 8318975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:09:44+00:00 2026-06-08T22:09:44+00:00

My application performs a series of processing methods once a day or when a

  • 0

My application performs a series of processing methods once a day or when a local notification is received to perform the series of tasks and is working as expected.

I tried adding an ActivityIndicator to a view that begins animating when a notification sent from the AppDelegate to perform the tasks is received. However all that happens is the screen darkens and none of the processing is done and the activity indicator doesn’t appear. The indicator and subview that darkens the screen is used elsewhere in the app and is definitely working. I think it must be something to do with the notifications causing the app to hang and not proceed to call any of the other methods so it never completes.

This is the notification in the app delegate which is called just before the daily processing methods are called to start the activity indicator in a view controller, and the second one notifies the view controller to remove the subviews.

This method is in the AppDelegate;

- (void)GoForRankingAndSMProcessing{

    [[NSNotificationCenter defaultCenter] postNotificationName:@"ranking" object:self];

    RankingAndSMProcess *process = [RankingAndSMProcess alloc];

    [process DoRankingAndSocialMediaProcessing];

    [process release];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"rankingDone" object:self];


}

Which is picked up in another view, with the notifications setup in viewDidLoad.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(workingWhileRanking:) name:@"ranking" object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(workingFinishedRanking:) name:@"rankingDone" object:nil];

And those call these methods in that view.

-(void)workingWhileRanking:(NSNotification *) notification{

    loading = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; 

    loading.opaque = NO;
    loading.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.6f];

    indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [indicator setHidesWhenStopped:YES];
    indicator.center = self.view.center;

    [indicator startAnimating];
    [self.view addSubview:loading];
    [self.view addSubview:indicator];

}

-(void)workingFinishedRanking:(NSNotification *) notification{

    [indicator stopAnimating];
    [indicator removeFromSuperview];
    [indicator release];
    [loading removeFromSuperview];
    [loading release];

}

The notifications must be sent as the translucent subview appears, however none of the processing methods seem to be called so the view is permanently locked out until I force close the app.

Does sending the notification change the current flow of the applications launch sequence thereby ceasing to continue executing code in a class? Or have I gone about trying to add an activity indicator to show during some behind the scenes processing the complete wrong way?

  • 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-08T22:09:45+00:00Added an answer on June 8, 2026 at 10:09 pm

    If I am not interpreting incorrectly your code:

    - (void)GoForRankingAndSMProcessing{
    
      [[NSNotificationCenter defaultCenter] postNotificationName:@"ranking" object:self];
      RankingAndSMProcess *process = [RankingAndSMProcess alloc];
      [process DoRankingAndSocialMediaProcessing];
      [process release];
      [[NSNotificationCenter defaultCenter] postNotificationName:@"rankingDone" object:self];
    }
    

    your DoRankingAndSocialMediaProcessing is the task you would like to execute while the activity indicator is showing.

    I assume that all processing happens on the same thread (UI thread), and this means that when you execute DoRankingAndSocialMediaProcessing basically your run loop (and hence, the UI) blocks and it is not updated any more. This should explain your issue.

    You have several options to change this behavior, depending on what you do in DoRankingAndSocialMediaProcessing.

    If you do not do anything related with the UI, it would be very easy to execute that method on a background thread by replacing the direct call to DoRankingAndSocialMediaProcessing with:

    [process performSelectorInBackground:@selector(DoRankingAndSocialMediaProcessing) withObject:nil];
    

    Of course you would then send the rankingDone notification from within DoRankingAndSocialMediaProcessing to make things work correctly.

    If you can afford a background thread (i.e., you are not updating the UI from within DoRankingAndSocialMediaProcessing) this is the best option, because it will not block the UI at all.

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

Sidebar

Related Questions

I have an application which performs 30 independent tasks simultaneously using multithreading, each task
I am working on an application that will perform a search against an online
I'm working with both silverlight and asp mvc. The silverlight application performs a page
I'm working on an application that accepts text in English and performs transliteration with
In my application I need to perform a series of initialization steps, these take
I have an application that performs a very sequential set of discrete tasks. My
Our Swing application performs some long-running tasks in a background thread using the excellent
I am trying to write an application that performs operations on a grid of
I am building a Zend Framework application that performs jobs submitted by the user.
I want to create an application that performs a particular action when the device

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.