CTFramesetterCreateWithAttributedString EXC_BAD_ACCESS
我使用核心文本来绘制某些东西,如果
CTFramesetterCreateWithAttributedString((CFAttributedStringRef)immutableContent);
我还打印 immutableContent
(它是一个 NSAttributedString
),它会收到 EXC_BAD_ACCESS
问题:
这里的问题是当发生这种情况时,我不知道如何调试它。 我猜 NSAttributedString 有问题,但我不知道如何修复它。此外,用于创建 NSAttributedString
的方法可以在另一个项目中使用。那为什么我很困惑~~
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的代码并且工作正常
self.attributedText - NSAttributedString
my code and works fine
self.attributedText - NSAttributedString
在我们的例子中,发生的情况是另一个线程在框架设置期间更改字符串的属性。 SAKrisT 的方法之一是制作副本。另一种方法是序列化对字符串
CTFramesetterCreateWithAttributedString
调用的访问。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.