Re: URL caching with XMLDoc from url
Re: URL caching with XMLDoc from url
- Subject: Re: URL caching with XMLDoc from url
- From: Fredrik Olsson <email@hidden>
- Date: Tue, 01 Aug 2006 11:18:20 +0200
Eric Blanpied skrev:
On Jul 31, 2006, at 11:47 pm, Fredrik Olsson wrote:
Eric Blanpied skrev:
<snip>
Something like:
NSURL *url = [NSURL URLWithString:someURLString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:nil];
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data
options:NSXMLNodeOptionsNone error:nil];
But my guess is that this is pretty much what
initWithContentsOfURL:options:error: does internally anyway.
// Fredrik Olsson
Would that allow me to control the caching better?
It would. You could instantiate the NSURLRequest using
requestWithURL:cachePolicy:timeoutInterval: instead of requestWithURL:.
As the documentation states, requestWithURL: defaults to
NSURLRequestUseProtocolCachePolicy and 60 seconds timeout. See docs for
more constants, and descriptions of them.
// Fredrik Olsson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden