iOS Tutorial Files and Folders

In iOS each application can only access its own private folders. There is no shared location such as File.DirRootExternal in Android.

iOS file system is case sensitive.

There are several standard folders. Each folder is intended for different usage.

File.DirAssets - This is a read-only folder. The files added to the Files tab in the IDE will be located here.

File.DirTmp
- The location of temporary files. These files will not be backuped by iTunes. The OS can clean this folder from time to time (you are also expected to delete unused files from this folder).

File.DirDocuments
- This folder should be used for user generated documents. It is backed up by iTunes automatically. It is possible to allow the user to access this folder from iTunes as explained below.

File.DirLibrary - This folder should be used for non-user generated persistent files (settings file for example). It is backed up by iTunes automatically.

The user available online storage is limited. If your program creates large persistent files then it might be better to exclude those files from the automatic backup.
This is done by calling File.SetExcludeFromBackup.

The files related methods are similar to B4A methods: http://www.b4x.com/b4i/help/files.html

B4A TextReader and TextWriter types are not available in B4i. If you need to use an encoding other than UTF8 then you should instead use File.ReadString2 or File.WriteString2.

Share your application files with iTunes

As mentioned above File.DirDocuments can be shared through iTunes.
In order to enable this feature you need to add this attribute:
B4X:
#PlistExtra: <key>UIFileSharingEnabled</key><true/>

Now the user will be able to access File.DirDocuments from iTunes:



The project is attached.
 

Attachments

  • iTunesFileSharing.zip
    4.3 KB · Views: 1,063
Last edited:

marcick

Well-Known Member
Licensed User
Longtime User
I'm running the sample, but in Itunes I can't see the sharing section as in the video.
Does the section appear only if th eapp is installed from the store ?
 
Top