NSSecureCoding & NSAttributedString
NSSecureCoding & NSAttributedString
- Subject: NSSecureCoding & NSAttributedString
- From: Markus Spoettl <email@hidden>
- Date: Fri, 16 Feb 2018 23:13:55 +0100
Hi there,
I have an app that stores - among other things - NSAttributedStrings. In the process of
converting the -initWithCoder: methods to NSSecureCoding I'm now hitting something I don't
know how to handle.
What I do is the following and it works (notes is an NSAttributedString * field
in my class):
notes = [[decoder decodeObjectOfClass:[NSAttributedString class]
forKey:@"notes"] retain];
I have one instance where the decoder throws and exception:
value for key 'NS.objects' was of unexpected class 'NSTextTab'. Allowed classes
are '{(
NSAttributedString,
NSParagraphStyle,
NSURL,
NSDictionary,
NSNumber,
NSFont,
NSGlyphInfo,
NSArray,
NSString,
NSColor
)}'
NSSecureCoding has some serious design flaws (collections, especially dictionaries) but as
long as one knows what objects they may contain one can make it work.
But how can I go about decoding NSAttributedString, how can I load such a string that
AppKit stored for me just fine.
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
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