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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:20:41+00:00 2026-06-11T01:20:41+00:00

I am loading data from an API and am using a UIProgressView to display

  • 0

I am loading data from an API and am using a UIProgressView to display how much has loaded.

In my viewWillAppear I use Reachability to check that there is an internet connection. Then, if there is, the following line is called 10 times in a function.

[self performSelectorInBackground:@selector(updateProgress) withObject:nil];

This then runs this method

-(void)updateProgress {
    float currentProgress = myProgressBar.progress;
    NSLog(@"%0.2f", currentProgress);
    [loadingProg setProgress:currentProgress+0.1 animated:YES];
}

The float increments by 0.1 and the loading view displays this.

When the view is dismissed (it is a modal view) and then recalled, the method runs and the NSLog shows that the currentProgress is incrementing as it should. However, the progress bar remains empty. Does anyone know what could cause this?

For reference, I am using ARC.

Update:

This is how I am calling the API

NSString *urlString = **url**;
NSURL *JSONURL = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:JSONURL
                        cachePolicy:NSURLRequestReloadIgnoringCacheData 
                        timeoutInterval:10];
if(connectionInProgress) {
    [connectionInProgress cancel];
}
connectionInProgress = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];

//This is where I call the update to the progress view

And I have these functions:

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    JSONData = [NSMutableData data];
    [JSONData setLength:0];
}

 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [JSONData appendData:data];
}

-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
    //add data to mutable array and other things
}
  • 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-11T01:20:43+00:00Added an answer on June 11, 2026 at 1:20 am

    When you are dealing with User Interface (UI) components, you must perform the methods in the main thread. As a rule when you program, you need to set UI operations in the main thread, and heavy, complex and more performance demanding operations in background threads – this is called multithreading (as a side suggestion, would be good to read about GCD – Grand Central Dispatch. If you need to do longer operations, check this good tutorial from Ray Wenderlich.)

    To solve this, you should call [self performSelectorOnMainThread:@selector(updateProgress) withObject:nil]; and then, in the method, the following:

    -(void)updateProgress {
        float currentProgress = myProgressBar.progress;
        NSLog(@"%0.2f", currentProgress);
        dispatch_async(dispatch_get_main_queue(), ^{
        [loadingProg setProgress:currentProgress+0.1 animated:YES];
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json object that I'm loading from wordpress using the JSON API
Currently I am loading data from a previous session into my application using the
I have a flash file that is loading data from XML file. After I
I am using BackGround Worker for Loading data from DB(MS Access). In my Form_Load
I have table view to load data from an API call. I am using:
I am loading data from table to flat file destination, where my flat file
We are loading data from db: var somethings = Context.SomethingSet.ToList(); Then someone deletes or
I'm loading data from a MySQL database into a C# .NET application. The data
In my application, I'm loading some data from a file. This can fail and
I'm reading data from a file -> saving into DB -> Loading my Custom

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.