Sandbox mechanism

1.  In order to ensure the absolute security of its own data, the Apple mobile phone has designed a sandbox file . Each application is equipped with its own sandbox file . Every time it is run , the name of the folder will become an irregular character. string

     

     The first parameter : which folder to go to currentlygo to the documents file with NSDocumentDirectory: line 64 , you can also go to the caches folder : corresponding to line 68

    

     The second parameter : the type of folder accessed specify the user folder when accessing

    

     The third parameter

     Absolute path (YES): It  is used by the system . The  system can find the folder according to the current path We use absolute paths when manipulating files.

     Relative path (NO hardly needed ): The  relative path will only show the folder you want to go to , and the  other parts are ~,  telling the programmer which file to go


2.  There are three folders in the sandbox

     (1)  is Documents files : mainly want to store some of the information used to store the user , such as the collection of information or something set up their own , so we do the collection function is to write something to the file folder

    

     (2) Library folder is easy to program developers to use , mainly to operate it in two folders , caches and  Preferences

     caches: Used to save cache files , SDWebImage will add pictures to the cache files , so the clear cache function is to delete this folder

     Preferences generally save the information set by the programmer , for example, NSUserDefaults will save the data in this folder

    

     (3) tmp file : generally store temporary content

     Before there is a sandbox  .app file , the new version has been removed

Guess you like

Origin blog.csdn.net/Michael_234198652/article/details/50809096