In article <oster-14136B.20333106052008@[EMAIL PROTECTED]
>,
David Phillip Oster <oster@[EMAIL PROTECTED]
> wrote:
> In article <Ivmdnf5LbqkGkbzVnZ2dnUVZ_ournZ2d@[EMAIL PROTECTED]
>,
> Don Bruder <dakidd@[EMAIL PROTECTED]
> wrote:
> > is there a simple, non-sync way of doing the deed? I envision a
fantasy
> > to the tune of "Here's a URL and a callback. Holler via the callback
> > when you've got the needed data so we can proceed"
>
> /* AppDelegate.h - tested, works */
>
> #im****t <Cocoa/Cocoa.h>
....
>
> @[EMAIL PROTECTED]
almost. The code I posted does work, for the case I tested.
There is one other NSURLConnection callback to handle,
that covers URLs that redirect.
There is additional complexity with NSURLCredentials, if you are trying
to access a password protected website, or the user is behind a
password-protected proxy.
There is additional complexity if you are doing HTTP PUTs or HTTP POSTs
to a URL that you haven't previously done an HTTP GET from, and that
URL redirects.
If you want to see code that handles all of these cases, take a look at
the GDataHTTPFetcher code in Greg Robbins' GData Objective C library.
http://code.google.com/p/gdata-objectivec-client/
http://code.google.com/p/gdata-objectivec-client/source/browse/trunk/Source/Networking/GDataHTTPFetcher.m
-- David Phillip Oster


|