Application Package: (bundle) contains all the resource files and executable files
Documents: Saves data that needs to be persisted when the app runs, and backs up the directory when the Ituns synchronizes the device. For example, a game app can save a game archive in that directory
Library/caches: Saves data that needs to be persisted when the app is run, and the directory is not backed up when Ituns synchronizes the device. Non-critical data with large storage volumes and no backup required
Library/preference: Save all your app's preferences, and the iOS Settings app will find the app's settings in that directory. Ituns the directory when synchronizing the device
TMP: Saves the temporary data required to run the app, and then deletes the response file from the directory when it is finished. When the app is not running, the system may also be aware of the files in that directory. Ituns The directory is not backed up when synchronizing the device
---------------------------------------------------------------------
Friendly tips:
1. If you do data access development, testing is best done on the simulator first, the simulation machine better look at the data file path.
2.iPhone development, if the file read and write operations, the same difference function is not error-free. If you want to write a file in a folder that does not exist, the method of reading and writing the file will execute normally without error, but the file will not be written!
NSString *home = Nshomedirectory (); Home is the application home directory path
NSString *tmpdir = Nstemporarydirectory (); Tmpdir is a temporary file directory path
Nssearchpathfordirectoriesindomains (nssearchpathdirectory directory, Nssearchpathdomaininmask DomainMask, BOOL Expandtilde); <
Nsarray *documents = Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES); <
NSString *docdir = documents[0]; <
First parameter: The type of directory to search, enumeration
Second parameter: The scope of the directory to be searched, usually the user directory scope is usually the user directory scope Nsuserdomainmask
Third parameter: Do you want to expand a tilde? ~ Corresponds to the application's, ~ represents the program's current directory
To have the view scroll up:
Nsrange is a struct: there are two parameters: location, and length
Nsrange range = Nsmakerange (content.length, 0);
[_textview Scrollrangetovisible:range];
------------------Mac Tips-----------------------------------
1. command to display Mac hidden files: Defaults write com Apple.finder appleshowallfiles-bool true
2. Hide Mac hidden files command: Defaults write COM Apple.finder appleshowallfiles-bool false
Note: You need to restart the Finder
-------------------------------------——-----------------------------------------------------------------
NSString----Need custom string encoding when saving
UIImage----Note that UIImage cannot write to a file and needs to be brokered using NSData data type, NSData can store any type of file in binary format
NSData *data = uiimagepngrepresentation (image); < generating image data
iOS Learning Notes (v) data storage