I'm trying to delete the localStorage files of my app, and to do that I need to know where the app stores its cached data, but I don't consistently get the correct path in the iOS simulator, this only works consistently on the phone.
I think this has something to do with the fact that Xcode renames the app directory when you rebuild. If I delete the entire /Users/john_doe/Library/Developer/CoreSimulator/Devices/
and start the app NSSearchPathForDirectoriesInDomains
finds the correct folder. On the next build the path that is returned is the new application directory, but the iOS simulator still uses the localStorage files in the old folder.
The code I run in Xcode to find the caches path: NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true).last as! String
tl;dr iOS simulator gives you a new application folder every time you stop and rebuild the app, but it uses the application folder from the first build for writing and reading the localStorage files.
Anybody have a workaround? A bug on this with Apple?