In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is Objective archiving". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what Objective archiving is.
In Objective-C, archiving is a process
That is, one or more objects are saved in a certain format so that they can be restored later.
Similar to serialization and deserialization in Java.
Applications on Mac OS X use XML attribute lists (or plists)
Stores data such as default parameter selection, application settings, and configuration information.
Use the PropertyList Editor program to create a list of properties.
Using the NSPropertyListSerialization class to write or read a list of attributes in a file can be migrated between different platforms.
Archiving methods generally include:
1) use the XML attribute list for archiving. (if possible, try to use the XML attribute list in the program.)
2) archiving using NSKeyedArchiver.
3) use NSData to create custom archives.
To archive objects that are not currently listed, you must tell the system how to archive (or encode) your objects and how to unarchive (or decode) them.
This is achieved by adding encodeWithCoder: method and initWithCoder: method to the class definition according to the protocol.
Each time the archiver wants to encode an object according to the specified class, it calls the encodeWithCoder: method
This method tells the archiving program how to archive.
Similarly, the initWIthCoder: method is called each time an object is decoded from a specified class.
In general, the coding method should specify how to archive each instance variable in the object you want to save.
Recovering data from an archive file is simple: you only need to do the opposite of an archive file.
First, you need to allocate a data space as before.
Second, read the data in the archive file into the data space.
Then you need to create a NSKeydUnarchiver object and tell it to decode the data from the specified space.
The decoding method must be called to extract and decode the archived object, and when done, a finishDecoding message is sent to the NSKeyedUnarchiver object.
Use the archiving program to copy objects:
You can use the archiving capabilities of Foundation to create deep copies of objects.
Thank you for your reading, the above is the content of "what is Objective archiving", after the study of this article, I believe you have a deeper understanding of what Objective archiving is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.