• 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: Scott Frankel <email@hidden>
  • Date: Wed, 10 May 2006 13:00:28 -0700


Current state: my app reads & writes binary data archived via default implementations.


I reverted back to the default implementations of [NSKeyedArchiver archivedDataWithRootObject:foo] and [NSKeyedUnarchiver unarchiveObjectWithData:data]. At first, the app exhibited the same crashing while reading the file, yielding this message in the log file:

	Exception:  EXC_BAD_ACCESS (0x0001)

The debugger, though, now shows that the array I unarchived into now contains member objects. So it seems the app had at least 2 problems.

The other problem I have partially traced back to code intended to manage undo of edits. (It exists in my -setFoo: method, called on the unarchived data.) I'm still troubleshooting this issue; though I can live without it for the moment.

I'm also living with binary archives until I get more familiar with rolling my own output format.

Thanks for the suggestions!
Scott




On May 9, 2006, at 8:51 PM, Scott Frankel wrote:


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];)

Any suggestions on how to debug this or docs that might point me in the right direction would be greatly appreciated! I've already read:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSKeyedUnarchiver_index.html#//apple_ref/doc/ uid/20000838.


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?" How would that data appear on disk? Does the former use the file selected with the Save browser, where the latter uses hard-coded paths? (A wild guess.) My document-based app attemps to make use of
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *) aType.



Thanks in advance! Scott



_______________________________________________
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

_______________________________________________ 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: Applescript not calling my code?
  • Next by Date: What is my data source ?
  • Previous by thread: Re: NSKeyedUnarchiver questions
  • Next by thread: Closing another window
  • Index(es):
    • Date
    • Thread