• 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: Moving to Keyed Archiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving to Keyed Archiving


  • Subject: Re: Moving to Keyed Archiving
  • From: Drew McCormack <email@hidden>
  • Date: Tue, 26 Aug 2003 21:32:34 +0200

On Tuesday, August 26, 2003, at 05:58 PM, Justin Anderson wrote:

There's one idea provided by Apple in the Cocoa Docs at <http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/ Tasks/convertingclasses.html>.

What you're looking for is down towards the bottom of the page, right before the sample code. The gist of it is that you should test for -containsValueForKey: (available in both NSKeyedUnarchiver and NSCoder). Apple's sample code on there is for NSCoder's -initWithCoder, but here's basically what you'd need to do for your -loadDataRepresentation: ofType:

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
NSKeyedUnarchiver *keyedUnarchiver = [[[NSKeyedUnarchiver alloc]
initForReadingWithData:data] autorelease];
NSUnarchiver *unarchiver = [[[NSUnarchiver alloc]
initForReadingWithData:data] autorelease];

Unfortunately this doesn't work. If the data is not in keyed format, you get the following


2003-08-26 21:21:25.592 Trade Strategist[13644] CFLog (0):
CFPropertyListCreateFromXMLData(): plist parse failed; the data is not proper UTF-8. The file name for this data could be:
com.apple.LaunchServices.00039363bc02.plist -- /Users/drew/Library/Preferences/ByHost/
The parser will retry as in 10.1, but the problem should be corrected in the plist.

Trade Strategist has exited due to signal 11 (SIGSEGV).


Unfortunately you don't get a nil object returned, or an NSException raised, it just dies with a signal 11. Bad.
How can I get around this? I need to be able to find out what is in the data without crashing my program.

Drew

----------------------------------
Dr. Drew McCormack
Trade Strategist (www.trade-strategist.com)
Stock Market strategy design platform for Mac OS X.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Moving to Keyed Archiving
      • From: Drew McCormack <email@hidden>
References: 
 >Re: Moving to Keyed Archiving (From: Justin Anderson <email@hidden>)

  • Prev by Date: Re: NSString -> char* ? Use -[NSString UTF8String].
  • Next by Date: Re: putting structs in NSArray
  • Previous by thread: Re: Moving to Keyed Archiving
  • Next by thread: Re: Moving to Keyed Archiving
  • Index(es):
    • Date
    • Thread