Re: How to get NSURL* form NSURLConnection?
Re: How to get NSURL* form NSURLConnection?
- Subject: Re: How to get NSURL* form NSURLConnection?
- From: "Rob Napier" <email@hidden>
- Date: Mon, 24 Mar 2008 18:35:59 -0400
Heh, you're right. I went looking through my code and realized that I've
solved it in the past by subclassing NSURLConnection to add a request
accessor or by maintaining a dictionary of connection->request objects in
the delegate.
I'm so used to my subclass that I forgot it's not in real Cocoa.... For an
example of the same issue solved for NSURLProtocol, you can look at some of
my code here:
http://code.google.com/p/pandoraboy/source/browse/trunk/ProxyURLProtocol.m
Focus on initWithRequest:cachedResponse:client for the basic idea (it's
really simple).
-Rob
On Mon, Mar 24, 2008 at 5:39 PM, Laurent Cerveau <email@hidden> wrote:
> Hi Rob
> Thanks for the answer. Unfortunately I do not see the points of getting
> the NSURLRequest. For example if I implement the delegate method
>
> - (void)connectionDidFinishLoading:(NSURLConnection *)connection;
>
> there is no NSURLRequest here (and no request accessor on the
> NSURLConnection) . Same issue with didFail delegate method. My problem is
> that I have to manage something like 1000 connections and just being able to
> not have to remember fro which URL there were would simply be nice
>
> Or do I miss something here?
>
>
> laurent
>
> On Mar 24, 2008, at 10:27 PM, Rob Napier wrote:
>
> You get the URL out of the NSURLRequest, which you can fetch at various
> points.
>
> -Rob
>
> On Mon, Mar 24, 2008 at 2:02 PM, Laurent Cerveau <email@hidden> wrote:
>
> > Hi
> >
> > When using NSURLConnection is there a way to get back the NSURL from
> > the NSURLConnection (in a delegate method)? Apparently if I log the
> > NSURLConnection it knows what URL is concerned but I do not find an
> > accessor for it.
> >
> >
> --
> Rob Napier -- Software and Security Consulting -- http://robnapier.net
> "Those who would give up essential liberty to purchase a little temporary
> safety, deserve neither liberty nor safety." -- B. Franklin, Printer
>
>
>
--
Rob Napier -- Software and Security Consulting -- http://robnapier.net
"Those who would give up essential liberty to purchase a little temporary
safety, deserve neither liberty nor safety." -- B. Franklin, Printer
_______________________________________________
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