I use core text to draw sth and it receives EXC_BAD_ACCESS
problem in case of
CTFramesetterCreateWithAttributedString((CFAttributedStringRef)immutableContent);
I also print immutableContent
which is a NSAttributedString
:
The problem here is when this happens, I don't know how to debug it. I guess there is sth wrong with the NSAttributedString
, but I don't know how to fix it. Besides, the method used to create the NSAttributedString
works in another project. So why I am confused~~
thanks!
my code and works fine
NSMutableAttributedString* attrStrWithLinks = [self.attributedText mutableCopy];
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attrStrWithLinks);
self.attributedText - NSAttributedString
In our case, what happens is that another thread is changing the attributes on the string during the framesetting. One approach is SAKrisT's, which is to work on a copy. Another is to serialize access to the string CTFramesetterCreateWithAttributedString
call.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.