• 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
NSSecureCoding & NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSSecureCoding & NSAttributedString
      • From: Quincey Morris <email@hidden>
  • Prev by Date: How to include UIColor picker in code-completion in Swift playgroundbook
  • Next by Date: Re: NSSecureCoding & NSAttributedString
  • Previous by thread: How to include UIColor picker in code-completion in Swift playgroundbook
  • Next by thread: Re: NSSecureCoding & NSAttributedString
  • Index(es):
    • Date
    • Thread