Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find all keys used in NSKeyedArchiver/NSKeyedUnarchiver

I have an NSData that was created by using NSKeyedArchiver. Is there a way to iterate over all the values inside it? It must somehow be possible to get all the keys that were stored in it when using +[NSKeyedUnarchiver unarchiveObjectWithData:].

Thanks

like image 791
stigi Avatar asked Nov 14 '22 05:11

stigi


1 Answers

A NSKeyedArchived file "simply" is a property list. You would need to find out the structure of that plist, though.

I found the source code of Cocotron very helpful one day, as I tried to decode some NSKeyedUnarchived data: http://code.google.com/p/cocotron/source/browse/Foundation/NSKeyedArchiving/NSKeyedUnarchiver.m (Maybe look at line 39 (initForReadingWithData:) which is called by unarchiveObjectWithData: (line #164)).

Maybe you can find out more about the archived objects that way.

like image 97
Christian Beer Avatar answered Dec 10 '22 22:12

Christian Beer