Re: Reading Archived Data From File
Re: Reading Archived Data From File
- Subject: Re: Reading Archived Data From File
- From: "Frederick C. Lee" <email@hidden>
- Date: Wed, 9 Jun 2004 10:50:10 -0700
Thank You!
Your observation is correct.
... And it makes sense when you reconsider the error message that was
returned:
< *** +[NSUnarchiver unarchiveObjectWith
Data:]: extra data discarded >
Which means that the keyed archive that was saved, was returned via
non-keyed unarchive which lost some data.
So obviously, you need to BALANCE the archive & unarchive (de-archive)
paradigms.
Thanks to all for responding!
Regards,
Ric.
On Jun 8, 2004, at 6:27 PM, Nick Zitzmann wrote:
On Jun 8, 2004, at 5:02 PM, Frederick C. Lee wrote:
Scenario: My NSMutableDictionary is composed of {CountryName Key/
CountryModel objects}. The CountryModel is a custom class that
contains assorted instance variables including a NSMutableDictionary
of
CityModels.
I noticed that you're trying to use NSKeyedArchiver and NSUnarchiver
together:
if (![NSKeyedArchiver archiveRootObject:theCountryMDict
toFile:countryDataSource]) { // Good
[...]
theCountryMDict = [[NSUnarchiver
unarchiveObjectWithFile:countryDataSource] retain]; // Fails to
populate theCountryMDict.
I'd suggest trying that again using NSArchiver (not NSKeyedArchiver)
to handle the archiving. Or, if you need NSKeyedArchiver, then use
NSKeyedUnarchiver to handle the unarchiving.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.