The simplest way to read and write plist files on iOS

Source: Internet
Author: User

Search on the Internet a circle, found a lot of code = = Small white do not want to see so many ah, and then pondering the next, the original so easy!

1     //Get plist path2NSString *plistpath = [[NSBundle mainbundle] Pathforresource:@"Config"OfType:@"plist"];3     //Get plist Data4Nsmutabledictionary *data =[[Nsmutabledictionary alloc] initwithcontentsoffile:plistpath];5     //reading plist Data6NSString *TESTSTR = [Data objectforkey:@"author"];7     //Writing plist Data8[Data setValue:@"This is the test data."Forkey:@"author"];9[Data Writetofile:plistpath Atomically:yes];

In fact, only need to open and then set up and then write it, no need to find what document under the directory AH what.

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.