NSString *path = Nshomedirectory ();
The code above gets the path to the application directory, where there are three folders: Documents, Library, temp, and a. App pack!
In this directory is the application sandbox, the application can only access folders under the directory!!!
Please refer to the following example:
1.
NSString *path1 = Nshomedirectory ();
NSLog (@ "path1:%@", path1);
Path1:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830
2.
NSString *path2 = [Nssearchpathfordirectoriesindomains (nscachesdirectory, Nsuserdomainmask, YES) lastObject];
NSLog (@ "path2:%@", path2);
Path2:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830/library/caches
3.
NSString *path3 = [Nssearchpathfordirectoriesindomains (nsdocumentdirectory, Nsuserdomainmask, YES) lastObject];
NSLog (@ "path3:%@", path3);
Path3:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830/documents
4.
NSString *path4 = [Nshomedirectory () stringbyappendingpathcomponent:@ "Documents"];
NSLog (@ "path4:%@", Path4);
Path4:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830/documents
5.
NSString *path5 = [Nshomedirectory () stringbyappendingpathcomponent:@ "Library"];
NSLog (@ "path5:%@", Path5);
Path5:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830/library
6.
NSString *path6 = [Nshomedirectory () stringbyappendingpathcomponent:@ "temp"];
NSLog (@ "path6:%@", Path6);
Path6:/users/yuanjun/library/application Support/iphone simulator/4.2/applications/ 172db70a-145b-4575-a31e-d501ac6ea830/temp
Actions for IOS files