Deploying mobile apps / Deploying mobile apps on iOS devices |
Platform-specific rules need to be considered when deploying on iOS devices (GMI).
On iOS devices, program interactions with the file system are limited to the directories inside the app's sandbox.
appdir/ |-- main.42m -- |-- *.42m | |-- *.42f | |-- fglprofile | | ... | |-- *.42s | |-- de/ | Program files | |-- *.42s | |-- fr/ | | |-- *.42s | |-- zh/ | | |-- *.42s | |-- ... other resource files/dirs ... | | ... | |-- webcomponents | | |-- component-type | | |-- component-type.html | | |-- other-web-comp-resource | | ... -- Documents/ |-- ... writable app files ... tmpdir/ |-- ... temporary files ...
Application program files (.42m, .42f, as well as other program resources) need to be deployed in the appdir directory.
The program files directory can be found in programs with the base.Application.getProgramDir method.
The FGLAPPDIR environment variable is automatically set to the appdir directory.
As with other program files, the "MAIN" module must be located under the appdir application program directory.
The current working directory for an iOS application is typically a writable "Documents" directory, in the private folder of the app. For example, the path to the working directory can be "/private/var/mobile/.../Documents".
The current working directory can be found in program with the os.Path.pwd method.
Files that need to be writable (such as SQLite database files) must be created or copied from the program files directory into the working directory. Copy must be done by the app at first execution, by using base.Application.getProgramDir, to find the program files directory, and os.Path.pwd(), to find the working directory.
A temporary directory is available for the application.
In order to find the temporary directory for the app, use the standard.feInfo front call, with the "dataDirectory" parameter.
To create a temporary file name, use the os.Path.makeTempName() method.
When the app starts, the appropriate .42s string files will be loaded from the directory corresponding to the current language settings of the mobile device. String files to be loaded can be defined in app's fglprofile, or you can use the main program name to avoid fglprofile settings.
For each language supported by your application, a directory must exist under appdir, with a name including the locale codes. Consider also providing default string files (in English for ex) directly under appdir, in case if the regional settings of the device do not match one of the locale directories of the app, otherwise the application will stop with error -8006.
For example:
appdir/mystrings.42s appdir/fr/mystrings.42s appdir/de/mystrings.42s
For more details, see Localized string files on mobile devices.
If you need to set fglprofile entries for your mobile application, create a file with the name fglprofile, and deploy it under the appdir directory, along with the other program files.
See Understanding FGLPROFILE for more details about fglprofile settings.
When a mobile application starts for the first time, it typically creates a new database, or copies a existing database template file from the appdir program file directory (base.Application.getProgramDir) to the working directory (os.Path.pwd).
For more details about database creation on mobile devices, see Creating a database from programs.