Decoding HTML in Swift causes BAD_ACCESS on iOS device -



Decoding HTML in Swift causes BAD_ACCESS on iOS device -

following great illustration of how decode html entities in swift? have managed decode html entity. however, running app in ios simulator causes no errors while testing on real device do.

i'm getting next error:

thread 1: exc_bad_access (code=1, address=0xc)

on line:

let attributedstring = nsattributedstring(data: encodeddata, options: attributedoptions, documentattributes: nil, error: nil)!

how go solving this?

probably not running code in main thread. not sure how working in simulator. anyway seek putting code in main thread block dispatch_async(dispatch_get_main_queue(), { allow attributedstring = nsattributedstring(data: encodeddata, options: attributedoptions, documentattributes: nil, error: nil) allow decodedstring = attributedstring?.string })

it should work properly.

html ios xcode swift decode

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -