Save iOS custom objects to a local file

Source: Internet
Author: User

I was to save the chat record locally, the use of a custom object, the data into the file format to the local, in the transfer of data format when the error, the need to first file the custom object to be transferred to the data format. Here's how:


First, declarations <NSCoding> agreements in. h Files











Ii. implementing the Encodewithcoder and Intiwithcoder methods in. m files



After archiving, the object is stored in a dictionary or array, converted to data format, and then stored locally.

See my other article on how to turn a dictionary into data format:

Address: http://blog.csdn.net/miaocuilin/article/details/40210281.

Save iOS custom objects to a local file

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.