Changes

Working with Directories in Swift on iOS 9

20 bytes removed, 20:34, 1 February 2016
m
Text replacement - "<google>BUY_IOS9</google>" to "<htmlet>ios9</htmlet>"
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
Where <user name> is the name of the user currently logged into the Mac OS X system on which the simulator is running, <device id> is the unique ID of the device on which the app is running and <app id> is the unique ID of the app, for example:
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
<pre>
06A3AEBA-8C34-476E-937F-A27BDD2E450A
Once executed, the string object referenced by tmpDir will contain the path to the temporary directory for the application.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
== Changing Directory ==
A new directory on an iOS device is created using the createDirectoryAtPath instance method of the NSFileManager class, once again passing through the pathname of the new directory as an argument and returning a Boolean success or failure result. The second argument to this method defines whether any intermediate directory levels should be created automatically. For example, if we wanted to create a directory with the path /var/mobile/Containers/Data/Application/<app id>/Documents/mydata/maps and the mydata subdirectory does not yet exist, setting the withIntermediateDirectories argument to true will cause this directory to be created automatically before then creating the maps sub-directory within it. If this argument is set to false, then the attempt to create the directory will fail because mydata does not already exist and we have not given permission for it to be created on our behalf.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
This method also takes additional arguments in the form of a set of attributes for the new directory. Specifying nil will use the default attributes.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>