• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: alternative to NSURLConnection sendSynchronousRequest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alternative to NSURLConnection sendSynchronousRequest


  • Subject: Re: alternative to NSURLConnection sendSynchronousRequest
  • From: Kevin Gessner <email@hidden>
  • Date: Tue, 13 Jan 2009 17:24:20 -0500

On Jan 13, 2009, at 4:27 PM, JB wrote:

Hi all,

I'm building a client for a server with (apparently) weird redirect issues,
I cannot get a proper HTTP response using NSURLConnection
sendSynchronousRequest


However, I can print out the response code using the asynchronous method:
[[NSURLConnection alloc] initWithRequest:request delegate:self];


When I swap this method in, I can print out the status code just fine.
However, because this approach is asynchronous my code calls this method and
moves on without waiting for a return value. I need the request to complete
before moving on.


How can I force my code to wait for the asynchronous request to finish,
without using sendSynchronousRequest?

You can split your post-connection stuff into another method, and call it from the delegate's implementation of connectionDidFinishLoading:. Then it will be called only when the connection is complete.


HTH
-- Kevin

Kevin Gessner
http://kevingessner.com
email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: alternative to NSURLConnection sendSynchronousRequest
      • From: JB <email@hidden>
    • Re: alternative to NSURLConnection sendSynchronousRequest
      • From: Jerry Krinock <email@hidden>
References: 
 >alternative to NSURLConnection sendSynchronousRequest (From: JB <email@hidden>)

  • Prev by Date: How can I change the time format for NSDatePicker?
  • Next by Date: Re: Strange Webview Problem
  • Previous by thread: alternative to NSURLConnection sendSynchronousRequest
  • Next by thread: Re: alternative to NSURLConnection sendSynchronousRequest
  • Index(es):
    • Date
    • Thread