Closed RiverRaid84 closed 4 years ago
It looks like the cache is returning the same file to you. In my case I did this. At the end of the station JSON url put this: let stationDataURL = "http://yoururl.com/json/stations.json?\(Int.random(in: 1...9999999))"
This would make your request think the URL is different at the end putting a number from 1 to 9999999. Do not forget to put the ? at the end of the .json file or at the end of your URL.
To this have affect, you need to fire up the app when you change your json file.
It looks like the cache is returning the same file to you. In my case I did this. At the end of the station JSON url put this: let stationDataURL = "[http://yoururl.com/json/stations.json?\(Int.random(in](http://yoururl.com/json/stations.json?%5C(Int.random(in): 1...9999999))"
This would make your request think the URL is different at the end putting a number from 1 to 9999999. Do not forget to put the ? at the end of the .json file or at the end of your URL.
To this have affect, you need to fire up the app when you change your json file.
Worked like a charm. Thank you very much. Much appreciated.
Is there away to get Pull to refresh to to update the stations? Currently after the fix by @urayoanm I have to kill the app to get the updated list of stations.
Thank you.
I think there is a function in the StationsViewController class to do that. Is called setupPullToRefresh()
Pull to refresh itself is setup correctly and it finds json. But UI doesn't update unless I re-run from Xcode or kill the app.
Hey @Egytalian
In DataManager.swift
try to set sessionConfig
(line 63
) requestCachePolicy
to:
sessionConfig.requestCachePolicy = .reloadIgnoringCacheData
Or:
sessionConfig.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
@fethica Thank you so much. It works great. Much appreciated.
I have uploaded the json file to a server, and when I update it it show on the web its updated but it doesn't reflect the update on the app. It takes a very long time to reflect the update in simulator but never does when I run the app on a physical device unless I delete the app and re-run agin.
Anyway to fix this and reflect the updates to the json file when they happen?
Thanks
PS: Pull to refresh doesn't do anything for this issue, neither killing the app.