-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSMutableAttributedString setFont functions crash with iOS 6 drawing functions #89
Comments
Thanks for the heads-up, I recentrly had this kind of issue reported and didn't have time to check yet but was already wondering why a crash would occur for that since iOS6… you solved the mystery before I even tried to :) What do you mean by "the old Core Text functions", is there any new function since iOS6 to do that, that would replace the current way we used to do it in iOS5? Didn't have time to check this out but if you have any info on any new way to do, I am interested! |
OK I got it, you talk about the new API to draw attributed strings (namely the NSAttributedString UIKit Additions, not any new API to build and NSMutableString and change its attributes like its font and so on. It seems that when using CoreText to draw the Not sure how to address that, as when you build your |
Yeah actually I found this when I constructed the NSAttributedString with your category, and then try to use it with UILabel on iOS 6, because UILabel on iOS 6 supports attributed strings (coincidentally, also using the No problem occurs if I continue to use OHAttributedLabel. So this is not a direct concern. But it is unfortunate, that it seems that attributed strings with attributes set from Core Text must be drawn with Core Text; and attributed strings with the new attributes defined in iOS 6 (https://developer.apple.com/library/ios/Documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/uid/TP40011688-CH1-DontLinkElementID_2) must be drawn using the new NSAttributedString UIKit drawing functions, or put in a UILabel. But you can't mix them or it will crash. |
Yes I see the problem. CoreText expects Thanks again for your feedback on this! As this is an iOS bug, I encourage you to report the bug to Apple (as I just did). |
Just a note: this issue is still ongoing as of September 2013. We only discovered this through provisioning and distributing for ad-hoc deployment - strangely it did not manifest itself when run in development. |
Sadly enough I can't do anything about that :( Apple uses the same key for the font attribute both for CoreText that expects a |
Just a heads-up.
NSAttributedStrings with the font attribute set using the old Core Text functions (which the methods in the NSAttributedString attributes category included with this project use), when drawn using the new iOS 6 NSAttributedString drawing functions, will crash.
It appears that Apple assumed that the attribute value would be a UIFont object, when the documentation for the Core Text font attribute (still) says that it needs to be a CTFont object.
Although this is an iOS bug and not you guys' fault, you should probably still keep this in mind.
The text was updated successfully, but these errors were encountered: