• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reading Archived Data From File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 unarchiveObjectWithData:]: 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.


References: 
 >Reading Archived Data From File (From: "Frederick C. Lee" <email@hidden>)
 >Re: Reading Archived Data From File (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Java or C++ for cross-platform Cocoa/.NET?
  • Next by Date: Re: Debugging bindings
  • Previous by thread: Re: Reading Archived Data From File
  • Next by thread: Losing Focus
  • Index(es):
    • Date
    • Thread