ios - Convert String from JSON to UIImage -


i'm receiving json data webservice, includes image represented sting. how can convert string image?

the json data in nsdictionary, , image data object form "content"-key:

if let newbannercontentstring = newbanner.objectforkey("content") as? string {     let someimage = uiimage(contentsoffile: newbannercontentstring) } 

this returns nil someimage.

if string base64 encoded create nsdata string , image data.

if let newbannercontentstring = newbanner.objectforkey("content") as? string {     let data = nsdata(base64encodedstring: newbannercontentstring, options: nsdatabase64decodingoptions.ignoreunknowncharacters);     let someimage = uiimage(data: data!); } 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -