Skip navigation.
 
mlRe: URL caching with XMLDoc from url
FROM : Fredrik Olsson
DATE : Tue Aug 01 11:18:20 2006

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

Related mailsAuthorDate
mlURL caching with XMLDoc from url Eric Blanpied Jul 31, 20:00
mlRe: URL caching with XMLDoc from url Fredrik Olsson Aug 1, 08:47
mlRe: URL caching with XMLDoc from url Eric Blanpied Aug 1, 10:20
mlRe: URL caching with XMLDoc from url Fredrik Olsson Aug 1, 11:18