0

I'm using RestKit in my iOS app to get my data and map them to objects in Core Data. The call returns an ETag so whenever the data is the same I'm getting a 304 from the server and no data is transfered.

This works perfectly fine and I'm happy with it.

BUT when I log out of my app, I need to clear those objects from core data. That works as well.

Then I want to clear the cached response so that the next time I log in RestKit does NOT send an ETag and that I can get the data again. So I'm doing this:

[[NSURLCache sharedURLCache] removeAllCachedResponses];

but it doesn't work, I'm still getting a 304 and no data.

How should I delete the ETag info??

4

1 回答 1

1

这是一个 HTTP 协议的东西,而不是 RestKit 的东西,所以你需要看看底层的处理/存储。所以,我希望你的代码能够工作。我认为 AFNetworking 不会创建自己的缓存实例,但它可能会 - 值得检查代码。

您可以NSURLRequest使用 RestKit 创建要发送的内容,然后将其设置cachePolicyNSURLRequestReloadIgnoringLocalAndRemoteCacheData.

于 2013-10-03T15:02:51.443 回答