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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:50:53+00:00 2026-05-22T17:50:53+00:00

I wrote a custom JSON fetcher. From my view controller I call [loader start];

  • 0

I wrote a custom “JSON fetcher”. From my view controller I call [loader start]; and when loader is done, it runs the delegate method [self.delegate doneLoading];.

This all works, however the UI is blocked — can’t move anything — until the loader is done. I thought that if I did the loading over my own delegate method, this wouldn’t happen. What am I missing here? Is there some extra method I need to call?

- (void)getBandArray
{
    if (![self localBandVersion] || [self remoteBandVersion] > [self localBandVersion] || !CACHING) {
        NSLog(@"Band array loaded remotely.");
    [self startLoadingBands];
}else{
    NSLog(@"Band array loaded from disk.");
    [self loadBandsFromDisk];

    }
}

startLoadingBands starts the NSURLConnection, loadBandsFromDisk looks like this:

- (void)loadBandsFromDisk
{
    NSData *dataFromDisk = [NSData dataWithContentsOfFile:[self fileStringForTag:JNKBandTag]];
if (dataFromDisk) {
    NSLog(@"Found band cache on disk...");

    NSString *strToParse = [[NSString alloc] initWithData:dataFromDisk encoding:NSUTF8StringEncoding];
    SBJsonParser *jsonObject = [[SBJsonParser alloc] init];
    NSError *jsonError;
    NSArray *parsedResult = [jsonObject objectWithString:strToParse error:&jsonError];
    [strToParse release];
    [jsonObject release];

    if (parsedResult && [parsedResult count] > 0) {
        NSLog(@"Parsed bands, handing over to delegate...");

        NSMutableArray *bandArray = [NSMutableArray array];
        for (NSDictionary *bandDict in parsedResult) {
            [bandArray addObject:[JNKBand bandWithDictionary:bandDict]];
        } 

        if ([self.delegate respondsToSelector:@selector(bandArrayArrived:)]) {
            [self.delegate bandArrayArrived:bandArray];
        }
    }else{
        NSLog(@"Error parsing bands, calling delegate...");
        if ([self.delegate respondsToSelector:@selector(bandArrayFailed)]) {
            [self.delegate bandArrayFailed];
        }
    }        
}else{
    if ([self.delegate respondsToSelector:@selector(bandArrayFailed)]) {
        [self.delegate bandArrayFailed];
    }
}
}

The weird thing is that once the connection is finished it also eventually calls loadFileFromDisk but this works smoothley…

  • 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-22T17:50:54+00:00Added an answer on May 22, 2026 at 5:50 pm

    This is running on the main thread which is blocking everything else. You will have to do the loading in the background. Use performSelectorInBackground:withObject to do the loading in the background and if the delegate method is supposed to affect the UI, you should send the request back to the main thread.

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

Sidebar

Related Questions

I have created custom result class to serialize json data to xml. I want
I have a controller that inherits from the org.springframework.web.servlet.mvc.AbstractController class I have configurated it
I wrote a custom error handler for my site and I'm aware that PHP
I'm using ExtJs 3.2.2. I wrote a custom context menu to handle a grid's
I want to write a custom next/prev function to dynamically display post information in
Background I've picked up some incomplete work from another developer that involves displaying the
I have multiple calls to many RESTful services. I translate to PHP using native
I'm fairly to MediaWiki and needed a way to automatically log users in after
So I have an app, and in the app there is a tableView ,
So I dynamically and programatically set separate datacontexts for different screens in my SL

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.