Actions for IOS files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.