Harry Pulvirenti
Harry Pulvirenti

Reputation: 565

NSXMLParser Cache

I'm developing an application that uses the xml parsing. Everything works wing perfection but when I edit the xml file changes are not displayed. I think it may be a matter of cache because the file is loaded correctly on the server. how do I fix it?

-(IBAction)avviaParsing{


 NSString *urlstring=@"http://www.acicastelloonline.it/app_ios/show.xml";
    NSURL *xmlURL=[NSURL URLWithString:urlstring];  

    NSXMLParser *parser = [[ NSXMLParser alloc] initWithContentsOfURL:xmlURL];

    [parser setDelegate:self];

    [parser parse];

        [parser release];}

Upvotes: 0

Views: 603

Answers (1)

bitmapdata.com
bitmapdata.com

Reputation: 9600

here is three option, you should try this code before XMLParsing:

you select only one of the three.

clearing

[[NSURLCache sharedURLCache] removeAllCachedResponses];


disable cache

NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; 
[NSURLCache setSharedURLCache:cache]; 
[sharedCache release];

this is other solution.

NSURL *xmlURL=[NSURL URLWithString:URL];
NSURLRequest *request = [NSURLRequest requestWithURL:xmlURL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:0.0f];
NSXMLParser *xmlParser =[[NSXMLParser alloc] initWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

Upvotes: 1

Related Questions