Do you need to delete imported files from documents / Inbox?

I have an iOS application that imports files from an email application. I noticed that as soon as I finish with it, it places the imported file in Documents / Inbox.

Should my application delete these files or does the OS end up costing to clean them?

if so, how? I tried:

[[NSFileManager defaultManager] removeItemAtPath:[self.url path] error:nil]; 

However, it does not reference the file in the inbox, although self.url is the correct path to my import file.

+8
ios objective-c iphone xcode ipad
source share
1 answer

The system does not clean the imported files, so you should clean them manually when necessary, but do not delete the document directory.

How to clear NSDocumentsDirectory you can find here

If you want to delete files from your inbox, use the same code that adds

 ... NSString *path = [NSString stringWithFormat:@"%@/Inbox", documentsDirectory ]; NSArray *directoryContents = [fileMgr contentsOfDirectoryAtPath:error:&error]; ... 

Read the link

From apple doc:

Use this directory to access the files that your application was asked to open external entities. In particular, Mail sends email attachments related to your application in this directory; document interaction controllers can also place files in it.

Your application can read and delete files in this directory, but cannot create new files or write to existing files. If a user tries to modify a file in this directory, your application should quietly move it from before making any changes.

The contents of this directory are created by iTunes.

+9
source share

All Articles