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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -