I am using the UIImagePickerController to take Images and videos for the App. What i need to ensure is the app takes minimum storage. So as soon as i have taken the image/video i upload it to my server so that i can access it using a url now.
Thus what i need is whenever the app terminates , i want to clear all the images and videos taken , so as to ensure less memory is consumed.
Please note that i do not want to delete the file immediately after uploading. I know how to delete a file from a directory individually.
Kindly suggest some other approach if I am wrong.
no guarantee that applicationWillTerminate
will ever get called may that is the reason you can not do that (Thus what i need is whenever the app terminates , i want to clear all the images and videos taken , so as to ensure less memory is consumed.) . so if your need to do anything before app exist then call applicationDidEnterBackground
but you can try on trick for that
Local notification on application termination
Update :
How to save images from Camera to specific folder in iPhone gallery?
and
Delete files in iOS directory using Swift
How to delete ALL FILES in a specified directory on the app?