I'm working on an app that uses the iPhone camera and after making several tests I've realised that it is storing all the captured videos on the tmp directory of the app. The captures don`t disappear even if the phone is restarted.
Is there any way to remove all these captures or is there any way to easily clean all cache and temp files?
Yes. This method works well:
Thanks to Max Maier and Roman Barzyczak. Updated to Swift 3, using URLs instead of strings.
Swift 3
Swift 4
One of the possible implementations
Swift 3 version as extension:
Example of usage:
Thanks to Max Maier, Swift 2 version:
Try this code to remove NSTemporaryDirectory files
and to check data remove or not write code in didFinishLaunchingWithOptions
This works on a jailbroken iPad, but I think this should work on a non-jailbroken device also.