2016-06-20 5 views
1

Я использую NSAttributedString в своем коде. Иногда я получаю следующий крах.NSAttributedString EXC_BAD_ACCESS KERN_INVALID_ADDRESS crash

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

Может ли кто-нибудь помочь мне на этом ?. Заранее спасибо.

+1

Вы можете показать код? –

+0

Вы используете в CFRunLoopRun в коде? – iMHitesh

+0

Вы также можете получить сбой, похожий на этот передающий «nil» в виде строки или данных. – Avi

ответ

3

Если вы работаете с HTML-строк в NSAttributedString он также может произойти сбой, как это сказано в 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.

В любом случае вы должны предоставить более подробную информацию для аварии, чтобы получить правильный ответ.

Смежные вопросы