• 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: NSKeyedUnarchiver questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSKeyedUnarchiver questions


  • Subject: Re: NSKeyedUnarchiver questions
  • From: James Bucanek <email@hidden>
  • Date: Wed, 10 May 2006 07:47:40 -0700

Scott Frankel wrote on Tuesday, May 9, 2006:

>
>I'm attempting to unarchive data my app has written to disk, but so
>far have not had any luck.  It dies leaving a signal 10 error.
>
>The following snippet:
>
>   NSMutableArray *newArray;
>   newArray = [NSKeyedUnarchiver unarchiveObjectWithFile:@"/absolute/
>path/to/theFile.plist"];
>
>yields newArray with zero content member items, as shown in the
>debugger.  Zilch.
>
>Using NSFileManager methods, I confirm what an `ls -l` in the
>terminal shows, that the file both exists and is readable.  Using
>`cat` in the terminal shows that the file contains what I believe is
>valid data.  (I archive it as human-readable ASCII characters using
>[archiver setOutputFormat:NSPropertyListXMLFormat_v1_0];)

Two things to try:

- Use the basic +[NSKeyedArchiver archiveRootObject:toFile:] to write the NSArray to the file in the default binary format; then try to see if you can read that back in. If that works, then something's hosed with how your are overridding the format.

- Check the logs for exceptions thrown during archiving or unarchiving. Attach a delegate to the NSKeyedUnarchiver and see if it throws any of the exception messsages (specifically unarchiver:cannotDecodeObjectOfClassName:originalClasses:).

>Also, in reading the doc (above), I note 2 methods:
>unarchiveObjectWithData and unarchiveObjectWithFile.  What does it
>mean to encode an object graph "in data," rather than "to a file?"

One method writes the serialized data to a file. The other serializes the data and writes it to an memory block and returns the serialized data as an NSData object: i.e. fprintf vs. sprintf

--
James Bucanek
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSKeyedUnarchiver questions (From: Scott Frankel <email@hidden>)

  • Prev by Date: Re: Quit menu item undimming itself?!
  • Next by Date: Re: Dynamic data model in Core Data
  • Previous by thread: NSKeyedUnarchiver questions
  • Next by thread: Re: NSKeyedUnarchiver questions
  • Index(es):
    • Date
    • Thread