2016-06-20 22 views
1

Ich verwende NSAttributedString in meinem Code. Manchmal bekomme ich einen Absturz.NSAttributedString EXC_BAD_ACCESS KERN_INVALID_ADDRESS Absturz

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

Kann mir jemand dabei helfen ?. Danke im Voraus.

+1

können Sie den Code anzeigen? –

+0

haben Sie in CFRunLoopRun in Code verwenden? – iMHitesh

+0

Sie können auch einen solchen Absturz bekommen, indem Sie 'nil' als Zeichenfolge oder Daten übergeben. – Avi

Antwort

3

Wenn Sie mit HTML-Strings in NSAttributedString arbeiten kann es auch zum Absturz bringen, wie es in docs sagte:

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.

Auf jeden Fall sollten Sie weitere Details für den Absturz bieten, um die korrekte Antwort.

Verwandte Themen