Access stored files in app's /Documents folder

Dear all,


My app writes some files to its /Documents folder.

I am using the following code:


NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    if (0 < [paths count])
    {
        NSString *documentsDirPath = [paths objectAtIndex:0];
        NSString *filePath = [documentsDirPath stringByAppendingPathComponent:fileName];
        NSFileManager *fileManager = [NSFileManager defaultManager];

         if ([fileManager fileExistsAtPath:filePath])
        {
         //FILE EXISTS
.......}
else
{
//FILE DOES NOT EXIST; CREATE IT
}


The file is created and stored successfully.

However, the apps' files can be only accessed from the Xcode through "Window"->"Device and Simulators"->"Download Container".


Is it possible to access these file without the assistance of Xcode IDE? For example, the iOS "Files" application does not show them.I tried many free third party applications from Apple Store but without success.


Regards,

Kostas

Answered by Claude31 in 399687022
Accepted Answer

The app creates the file when it is launched, and it continuously stores data until the user stops the process (by clicking a button or exit). The app keeps a log file, which means that app appends file's contents every so on.

On your proposal, it seems to me that you just select the name of the file, it is created and that's it (file is closed). It is more appropriate for storing e.g. a pdf file.


Is any other way to select the folder without the

UIActivityViewController
?

I also decided to store files in app's /Document folder and allow access to it by setting the property "Application supports iTunes file sharing" to "YES" on plist file of my project.

Access stored files in app's /Documents folder
 
 
Q