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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:21:26+00:00 2026-06-07T22:21:26+00:00

One view of my iOS application is a UISearchDisplay. I have designed it as

  • 0

One view of my iOS application is a UISearchDisplay. I have designed it as a type-ahead search, so that whenever the user enters a new character the table is re-populated. I have done this by implementing the UISearchDisplayDelegate protocol method:

searchDisplayController:shouldReloadTableForSearchString:

In this method I take the string provided and append it to my query URL. I then create a new NSURLConnection and submit a new asynchronous request. I receive and append data via the delegate method:

connection:didReceiveData:

Once the connection has finished downloading the data, via the method:

connectionDidFinishLoading

I pass the data to an instance of NSXMLParser. The data that is receive is an XML file of all the contacts in my database which match the given string. Once the data has finished being parsed I reload the table.

My Problem: If the user types in text fast enough, there will be multiple connection and parsing tasks going on at the same time. This is an issue because I have one instance of NSMutableData which I append data to and parse. Hopefully you can see where I am going with this.

Does anyone have any suggestions for improving my implementation and/or solving this critical-section problem?

  • 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-07T22:21:28+00:00Added an answer on June 7, 2026 at 10:21 pm

    NSXMLParser is not asynchronous. This one trips a lot of people up, since they assume that it is due to its use of delegate callback methods. However, actually the parse method doesn’t return until all the parsing is finished.

    So while you may have multiple connections going at once, you won’t have multiple parsing operations happening unless you’ve multithreaded it yourself.

    To solve the multiple connections problem, how about instead of having one single NSMutableData you have one per connection? There are a number of ways to do that: you might want to look at answers to the following questions for ideas.

    • Cocoa: Checks required for multiple asynchronous NSURLConnections using same delegate functions?
    • Managing multiple asynchronous NSURLConnection connections
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I want to have one view that holds 2 partial views.
I'm new to iOS and Objective-C. I have an application that displays a table
So I have two TableView in one view of an iOS app. I have
I have an application with tab bar and 3 different View Controller. one of
I am creating navigation based iphone application.In that i have to move from one
I am creating one application in iOs 5 using story board and in that
I have custom view in my application which can be scrolled by the user.
I would like to add admob at my ios application. I have follow that
I have an IOS App that can open a specific type of documents. My
I'm working on an iOS app where I want to load one view if

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.