在我的申請,我現在用的是NSURLConnection
方法加載JSON數據,看起來像這樣:NSURLConnection的將返回舊數據
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:
[NSURL URLWithString:@"theurl"]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request
delegate:self];
[theConnection start];
我收到並保存在-didReceiveData:
方法的數據,但如果更新我的我的服務器上的JSON文件,NSURLConnection
仍然爲我提供舊的JSON,而文件正確上傳到服務器。只有當我從iPhone(或iPhone Simulator)中刪除整個應用程序並重建應用程序時,它纔會收到新的Json文件。
有沒有人知道這個問題的解決方案?
聲音像結果被緩存,看到[這個答案](http://stackoverflow.com/questions/405151/is-it-possible-to-prevent-an-nsurlrequest-from-caching-data-or-remove-cached -dat) – Douglas 2012-01-01 19:37:51
謝謝!你和傑西的答案對我有用! – Jelle 2012-01-01 19:59:13