开发者

iPhone disabling caching for stringWithContentsOfURL

I have an iPhone app which needs to load some data from a URL. I have the following line of code:

NSString *versionControlContents = [NSString stringWithContentsOfURL:[NSURL URLWithString:versionControlURL] encoding:encoding error:NULL];

The issue that I'm having is that if the contents of the URL have changed since the first time the URL was loaded, the changes aren't being reflected. Every subsequent time that line of code runs, versionControlContents ends up with the same content as the first time it ran.

I'm assuming this is because the iPhone has some sort of caching mechanism so that it doesn't actually load the data from the URL every subsequent time. How can I disab开发者_如何学Cle this temporarily?

Thanks!


You might try + requestWithURL:cachePolicy:timeoutInterval:

Then you can set your cacheing policy as you wish.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/Reference/Reference.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜