0

I am developing app. It includes login page. After login I receive the response json. I tried the login multiple times with two different accounts.

Lets say account A & B. If I build and run fresh build on device and login with account A. I get the correct response. If I logout and re-login with the account B. In this case, I get the old response of the account A.

The problem remains if I do vice-versa. There is no issue with the web services.

I need to know whether there is issue with response caching in ios. I tried to implement this with the NSURLConnection, NSURLSession, and AFNetworking. The problem stays.

I have implemented the same for the android device. no response issue on android.

Can anybody suggest anything on this situation. Any suggestions are highly appreciated.

Tim007
  • 2,557
  • 1
  • 11
  • 20
Ganesh
  • 101
  • 1
  • 11

1 Answers1

0

NSURLCache has no notion of accounts. You'll have to either tell it to remove all cached items or disable caching. Realistically, caching JSON responses is almost never the right thing to do, so you should probably disable caching for those requests.

dgatwood
  • 10,129
  • 1
  • 28
  • 49