• 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
help with archiving bug, a head-scratcher
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with archiving bug, a head-scratcher


  • Subject: help with archiving bug, a head-scratcher
  • From: John Brownlow <email@hidden>
  • Date: Wed, 16 Mar 2005 17:24:08 -0500

In my screenwriting app there is a very simple dataRepresentationOfType: method which among other things encodes the text of the screenplay as follows:

id textToSave = [NSMutableAttributedString new];

[textToSave setAttributedString: [theTextView textStorage]];

NSMutableData *data;
NSKeyedArchiver *archiver;

data = [NSMutableData data];
archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];

[archiver encodeObject: textToSave forKey:@"textOfScreenplay"];

[archiver finishEncoding];
[archiver release];


		return data;

then it is decoded in loadDataRepresentationOfType: as follows:

NSMutableAttributedString *theNewText;
NSKeyedUnarchiver *unarchiver;

unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:dataToLoad];

theNewText = [[unarchiver decodeObjectForKey:@"textOfScreenplay"] retain];


However, in most circumstances, the unarchiver complains as follows:

2005-03-16 17:07:08.474 Greenlight[14763] *** initialization method -initWithObjects:forKeys:count: cannot be sent to an abstract object of class NSAttributeDictionary: Create a concrete instance!

For example, a file containing only the word 'foo' whose textStorage looks like this, according to TextExtras:

2005-03-16 17:12:57.717 Greenlight[14812] foo<NSAttributeDictionary: 0x5bebcd0>

... will throw the above.

The only thing I have done that is out of the ordinary is to subclass NSMutableParagraphStyle to add some attributes of my own. However, the 'foo' example above doesn't use my GLMutableParagraphStyle class so I can't understand why it would be unhappy.

Any help gratefully received.

		




-- John Brownlow Deep Fried Films, Inc

http://www.johnbrownlow.com
http://www.pinkheadedbug.com

_______________________________________________
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


  • Prev by Date: ASCII File IO
  • Next by Date: Re: NSBezierPath compositing
  • Previous by thread: Re: ASCII File IO
  • Next by thread: OmniWeb Like view transition in tableview cell
  • Index(es):
    • Date
    • Thread