• 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
NSUnarchiver and StickiesDatabase
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUnarchiver and StickiesDatabase


  • Subject: NSUnarchiver and StickiesDatabase
  • From: Matthew <email@hidden>
  • Date: Wed, 12 Jan 2005 23:11:24 -0500

Has anyone had any luck loading the ~/Library/StickiesDatabase file using an NSUnarchiver? Using class-dump on the Stickies binary file in the app bundle gives the relevant info. Basically, an object of type Document (no relation to NSDocument) appears to be in individual note with some standard attributes. So I've defined the implementation for this interface (mostly KVC stuff), and everything compiles fine. Peeking in the StickiesDatabase file confirms that this data is almost certainly encoded using NSArchiver, and uses this structure revealed via the class-dump below:

@interface Document : NSObject <NSCoding>
{
    int mWindowColor;
    int mWindowFlags;
    NSRect mWindowFrame;
    NSData *mRTFDData;
    NSDate *mCreationDate;
    NSDate *mModificationDate;
}

- (id)init;
- (void)dealloc;
- (id)initWithCoder:(NSCoder*)fp8;
- (id)initWithData:(NSData*)fp8;
- (void)encodeWithCoder:(NSCoder*)fp8;
- (NSDate*)creationDate;
- (void)setCreationDate:(NSDate*)fp8;
- (NSDate*)modificationDate;
- (void)setModificationDate:(NSDate*)fp8;
- (NSDate*)RTFDData;
- (void)setRTFDData:(NSData*)fp8;
- (int)windowColor;
- (void)setWindowColor:(int)fp8;
- (int)windowFlags;
- (void)setWindowFlags:(int)fp8;
- (NSRect)windowFrame;
- (void)setWindowFrame:(NSRect)fp8;

@end


After a long, long time working on this, I am unable to get it to load using the basic approaches such as unarchiveObjectWithFile and decodeValueOfObjCType.


It doesn't seem that this should be quite as difficult as I'm making it, so I have to ask if there's a detail I'm overlooking. If the Document class is defined with the correct data instances, shouldn't a simple call to unarchiveObjectWithFile work? If this is the case, then can you think of any gotcha's on a task like this?

Another way to ask this might be "if you were given an file encoded with NSArchiver without any details about its contents other than an interface file outlining its data instances, how would you unarchive it?"

_______________________________________________
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


  • Follow-Ups:
    • Re: NSUnarchiver and StickiesDatabase
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: IB Palettes, custom classes and the need for Frameworks
  • Next by Date: Re: Cocoa/Objective-C's Relative Performance
  • Previous by thread: Re: NSWindow orderOut: causing a crash?
  • Next by thread: Re: NSUnarchiver and StickiesDatabase
  • Index(es):
    • Date
    • Thread