Parts of my app use Core Text. I build an CFAttributedStringRef which contains attributes as defined by CTStringAttributes, which are needed to render the text with Core Text, which all works fine.
A different part of my app provides an interface to edit this text. On the Mac, this uses NSTextField. I cast by CFAttributedStringRef to NSAttributedString and try to set it in the text field using -setAttributedStringValue: Chaos ensues, with the text system throwing exceptions all over the place, and eventually crashing with a EXC_BAD_ACCESS. CFAttributedString is toll-free bridged to NSAttributedString, but the new Core Text attributes are wholly incompatible, apparently, with the classic NSAttributedString handling classes such as NSTextField. I find myself surprised by this, that a whole slew of new attributes were defined for Core Text without updating existing code to handle them gracefully. That's very bad "not joined up" thinking on Apple's part. There are now two entirely incompatible variants of NSAttributedString that can't be distinguished externally, one variety of which will cause severe problems for all the existing code that handles these objects. Unless I'm doing something wrong of course.... Has anyone else run into this? Am I expected to do Apple's work and go through every possible attribute of an NSAttributedString and sanitise it so that it works both with Core Text and the classic text system? This seems wrong, but after investigating the problem it appears that I have no choice. I find myself baffled that Apple has done this, which is why I wonder if I've missed something. --Graham _______________________________________________ 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