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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:05:24+00:00 2026-06-15T13:05:24+00:00

First off, a big thank you to the SO community. I have learned a

  • 0

First off, a big thank you to the SO community. I have learned a great deal. However, I am still an extreme novice w/re to Objective C and thus have a question. Apologies in advance if this is an ignorant question.

I have subclassed NSURLConnection to fetch my custom objects (myObject) from my web API. Each object requires 2 calls to the API for completion. The first call is to grab an id property from a list of my Objects. The second call is the to use that id to construct a different URL and populate the rest of the myObject properties. All is working well but I have a question as to the correctness of my approach for reloading a tableViewsection based on a completion of all of themyObjectobjects within anNSMutableArray`.

Here is the method I call after successfully instantiating and fetching all of the incomplete myObjects and adding them to an NSMutableArray. messageStringis a property of myObject that is only available/set on the second network call for each of the instances of myObject. Thus, I thought I would use it to check for completeness. arrayOfMyObjects is mutable and contains all of the incomplete myObjects. MyStoreClass is just that. A store that handles the creation of the subclassed NSURLConnections.

- (void)fetchDetails {

void (^completionBlock)(myObject *obj, NSError *err, int statusCode) = ^(myObject *obj, NSError *err, int statusCode) {

    if (!err && statusCode == 200) {

        NSArray *completionCheckArray = [arrayOfMyObjects filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"messageString = %@", [NSNull null]]];

        if ([completionCheckArray count] == 0) {
            [[self tableView] reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationAutomatic];
        }


    } else if (!err && statusCode != 200) {
        [self statusCodeError:statusCode];
    } else {
        [self generalError:err];
    }
};

    for (myObject *mobj in arrayOfMyObjects) {
    [[MyStoreClass sharedStore] fetchDetails:mobj withCompletion:completionBlock];
    }
}

While this works, it seems inefficient to me to have to create an array through the completion block for every single one of myObjects. If so, what would be an alternative approach to checking completion of all of myObjects?

  • 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-15T13:05:25+00:00Added an answer on June 15, 2026 at 1:05 pm

    A possible and feasible approach would be to go wit KVO (Key Value Observing). Check out the appropriate Key-Value Observing Programming Guide.

    For example: If you know how many objects (i.e. object count) you’re expecting from a given service call,
    you could hook up an observer on the array object holding your objects and be notified whenever an element is added etc.
    See Observing an NSMutableArray for insertion/removal.

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

Sidebar

Related Questions

First off, I've never used GWT before. I have good experience in HTML/CSS/JS/JSP. I'm
First off I am new to this site and it is a big help,
First off i am a big fat NOOB in regards to Sharepoint 2007 webpart
First off, I'll admit that I'm anal about such things. (Bad, bad, me.) However,
First off, the square draws fine and it does work, but there are still
First off, a big thanks to the people behind the new boost::geometry library! This
first off I'm a noob to PHP but here is my problem. I am
First off, I'm coming (back) to Java from C#, so apologies if my terminology
First off, I would like to make clear, that I am SUPER NEW TO
First off I use this code to make the navigation bar always stay fixed;

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.