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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:41:23+00:00 2026-06-09T02:41:23+00:00

So I have a UIViewController which loads data asynchronously using NSOperationQueue . I had

  • 0

So I have a UIViewController which loads data asynchronously using NSOperationQueue. I had the commented out line at first when I was using seed data, but now I have switched to using the actual service. The data gets to this method appropriately, but the UI isn’t updating. I then read you need to run UI updates on the main thread, so I changed it to the below code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.menuView = (MenuView*)self.view;
    [MenuUIModel loadAndOnSuccess:^(id data, id context) {
        [self.menuView performSelectorOnMainThread:@selector(bindToModel:) withObject:data waitUntilDone:YES];
        //[self.menuView bindToModel:(MenuUIModel*)data];
    } onFail:^(NSString *error, id context) {
        NSLog(@"FAIL with error: %@", error);
    }];
}

Here is the MenuView, though slightly trimmed.

@interface MenuView : UITableView

@property (strong, nonatomic) NSArray *menuItemViews;

// Menu Item View Loading Outlet
@property (strong, nonatomic) IBOutlet MenuItemView *lastLoadedMenuItemView;

- (void) bindToModel:(MenuUIModel*)model;

@end

@implementation MenuView

- (void)bindToModel:(MenuUIModel*)model
{
    if (model) {
        NSMutableArray *mutableMenuItemViews = [NSMutableArray array];
        UINib* inMemoryNib = [UINib nibWithNibName:@"MenuItemView" bundle:nil];
        for (MenuItemUIModel *item in model.Items) {
            [inMemoryNib instantiateWithOwner:self options:nil];
            [self.lastLoadedMenuItemView bindToModel:item];
            [mutableMenuItemViews addObject:self.lastLoadedMenuItemView];
            index++;
        }
        self.menuItemViews = [[NSArray alloc] initWithArray:mutableMenuItemViews];
    }
}

@end

I realize this method of loading nibs is a little different, but the purpose is so I only load the nib and its resources into memory once but instantiate it as necessary. It also works wonderfully with the seed code.

So I thought that running this method on the main thread would work, but apparently not. Another note, I added a test UILabel to MenuView and it updated perfectly when I tested it in this method. So when I call bindToModel inside of my MenuView does that no longer run on the main thread or something?

  • 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-09T02:41:24+00:00Added an answer on June 9, 2026 at 2:41 am

    Edit: My first response confused the Cocoa desktop bindings mechanism
    with the methods you are referring to here as bindings. Cocoa bindings
    are not implemented at all in Cocoa Touch on iOS, so my previous
    advice was irrelevant. Sorry about that!

    To answer your question, from the code you’ve shown, yes everything in your -bindToModel: method is running on the main thread. There is no obvious problem with your threading model visible here.

    I would suggest adding some NSLog() calls inside your -bindToModel: methods to ensure everything is working as you expect. The output to the console log will include a thread id, so you can tell for certain that things are happening on the thread you intended.

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

Sidebar

Related Questions

I have a UIViewController which when it loads it loads up this.. MapViewController *mapController
I have a project which loads a UIViewController aka appViewController to the UIWindow full
I have a UIViewController (which sits inside a tabUIController). Within this UIViewController, I want
I have one UIViewController (DownloadManager) which downloads a webpage with UIWebView and display the
I have a root UIViewController which has a property called webView. WebView is a
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have a UIViewController — let's call it FormController — which is simply a
I have BaseView which implement UIViewController. Every view in project must implement this BaseView.
I have a custom UIViewController subclass, which gets pushed on a UINavigationController stack. I
I have a custom UIViewController, which is the only subView of UIView. The UIViewController

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.