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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to