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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:52:21+00:00 2026-05-24T13:52:21+00:00

I am using a search bar and whenever i enter a text in the

  • 0

I am using a search bar and whenever i enter a text in the search bar it should take that string and it will form a request string and produce the output.To be more clear assume like if i press ‘c’ i want to display city names staring with c and after that with the ‘c’ still present in the search bar i press ‘h’,so now the string is ‘ch’ so using the webservice i am searching for citiy names that start with ‘ch’.I use a JSON kind of webservice and the response is populated on the table view

My problem is when i press the keys slowly the searching is done properly,but when the keys are pressed fastly that is when i press ‘c’ and then swiftly i have pressed ‘h’.The webservice is accessed for ‘ch’ then ‘c’..This makes to print the cities starting with c instead of CH..

I am calling the web service on each key press in the following way:

statement to call the webservice inside the

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchString {

....

...
 [NSThread detachNewThreadSelector: @selector(callService) toTarget:self withObject:nil];
}

and inside the callService method.....

- (void)callService{
    NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ];
    [self performSelectorOnMainThread:@selector(initializeRequest) withObject:nil waitUntilDone:NO]; 
    [pool release];

}

- (void)initializeRequest {


....Here i form the request string...
create connection and after creating connection i use NSURLConnectionDelegate Methods to parse the connection
}

Is there is any way to do the searching on the fly smoothly.

Please any body suggest me any other alternative or approach to perform this kind of search on the fly when the text gets changed in the search bar.Thank you one and all

  • 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-24T13:52:23+00:00Added an answer on May 24, 2026 at 1:52 pm

    Keep track of your connections, and when you form a new request, cancel the old connection first.

    [prevURLConnection cancel];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jqGrid that is using the toolbar search with some text searches
I have a base Twig template that has a search bar form in it
I have a site with content that is searchable using a search bar that
I am using solr search engine to query an index for classifieds that match
I am using jQuery DataTables . I want to remove the search bar and
How can I implement Google Search using the Search Bar in iPad/iPhone App ?
I'm using VS2010 and can't seem to find how to enable the search bar
I am using a search bar in my app and display some results below
I am using an UI search bar into my iPhone application, I would like
I added a search bar in the UINavigationItem using the following code: UISearchBar *searchBar

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.