issues using encodeWithCoder: with NSAttributedString for iOS
issues using encodeWithCoder: with NSAttributedString for iOS
- Subject: issues using encodeWithCoder: with NSAttributedString for iOS
- From: Michael Swan <email@hidden>
- Date: Mon, 27 Feb 2012 00:44:12 -0500
I have a UIDocument with a single property, an NSAttributedString, that I am trying to save. The documentation says that NSAttributedString conforms to the NSCoding protocol so I'm using NSData *docData = [NSKeyedArchiver archivedDataWithRootObject:self.contents]; where self.contents is the NSAttributedString. The only problem is that every time the document tries to save I get the following exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType encodeWithCoder:]: unrecognized selector sent to instance 0x79eaced0'
The instance listed is a CGColor. I am not encoding anything other than the NSAttributedString so the CGColor must belong to it, the thing that doesn't make any sense is that if NSAttributedString conforms to the NSCoding protocol it must be able to fully pack itself up when encodeWithCoder: is called on it which means that it should already be taking care of encoding the CGColor in whatever way necessary.
Is there something I'm missing?
Has anyone run into this before? If so is there a workaround?
Or, have I managed to find a bug that no one else has come across yet (I find this highly unlikely as surely someone is saving NSAttributedStrings somewhere)?
Thanks,
Mike Swan
http://www.theMikeSwan.com
"Every experience in your life is an opportunity to learn something new and to make a change for your ultimate benefit."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden