gpt4 book ai didi

ios - NSAttributedString EXC_BAD_ACCESS KERN_INVALID_ADDRESS 崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:55:53 26 4
gpt4 key购买 nike

我在我的代码中使用了 NSAttributedString。我有时会遇到以下崩溃。

Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000114f2841 Raw 0 libobjc.A.dylib
objc_msgSend + 5 15 UIFoundation
-[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 116

有人可以帮我解决这个问题吗?。提前致谢。

最佳答案

如果您在 NSAttributedString 中使用 HTML 字符串,它也可能会崩溃,如 docs 中所述:

The HTML importer should not be called from a background thread (that is, the options dictionary includes NSDocumentTypeDocumentAttribute with a value of NSHTMLTextDocumentType). It will try to synchronize with the main thread, fail, and time out. Calling it from the main thread works (but can still time out if the HTML contains references to external resources, which should be avoided at all costs). The HTML import mechanism is meant for implementing something like markdown (that is, text styles, colors, and so on), not for general HTML import.

无论如何,您应该提供有关崩溃的更多详细信息以获得正确答案。

关于ios - NSAttributedString EXC_BAD_ACCESS KERN_INVALID_ADDRESS 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37915411/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com