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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:50:21+00:00 2026-05-29T20:50:21+00:00

I have an app that allows searches of an sql db by various fields

  • 0

I have an app that allows searches of an sql db by various fields (name, city, id) I have tried to implement the searches as NSOperations in a queue. and the ui is updated between the first search but for some reason the tableview will not respond to touches while the operations are continuing in the background. Not sure what i’ve missed or if i need a custom runloop for the operation queue if so would appreciate some help with that as i’m not familiar enough with that here’s my existing code

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {


    NSString *searchText = searchBar.text;
    [self.searchQueue cancelAllOperations];    //NSOperationQueue
    [self.searchResults startSearching:searchText];
    [self searchID:searchText];

    NSInvocationOperation *operation1 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(searchName:) object:searchText];
    [self.searchQueue addOperation:operation1];
    [operation1 release];

                //NSLog(@"Add city search");

    NSInvocationOperation *operation2 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(searchCity:) object:searchText];
    [self.searchQueue addOperation:operation2];
    [operation2 release];
}

so what happens is the UI is held until the first search ends (that’s ok) and it refreshes the table view. As as each operation completes it refreshes the tableview, however during this time the tableview will not respond to touches…

the task itself looks like this..

-(void) searchCity:(NSString *)City{
    searchObject *myCity = [[searchObject alloc] init];
    self.searchResults.cityResults = [myCity searchCity:City];  //returns NSArray of items

    if ([self.searchResults.cityResults count] == 0) {

        [self.searchResults.cityResults addObject:[NSArray arrayWithObjects:@"Not Found.",@"",@"",@"",@"", nil]];
    }
    [self.searchResults refreshView];
        //NSLog(@"Added from City Search\n%@",self.searchResults.cityResults);
}
  • 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-29T20:50:28+00:00Added an answer on May 29, 2026 at 8:50 pm

    OK i answered my own question but for the next folks…

    it was as simple as ensuring that the tableview refresh was performed on the main thread…

    [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL interface page in my classic ASP web app that allows
I have a CMS app that allows custom fields to be added. One type
I have an app that allows you to create Home shortcuts to a specific
I have an app that allows the user to choose an image, at design
I have a Flex App that allows you to dynamically build an animation. It
We have a WPF app that allows our users to download encrypted content and
I have an existing web app that allows users to rate items based on
I have an app that allows sends the user an alert through the notification
We have an app that allows users to send e-mails from our system. It
I have an app that allows users to generate objects, and store them (in

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.