ios - Getting Memory waning in UIImage?(data:) -
i getting image data
server.to show using uiimage?(data:)
show it.for specific image application getting crash because of memory pressure. reason, how fix it.
if let imgdata = utils.fetchdatafromdocumentdirectory(imagename:"test.jpg"){ attachmentimgview.image = uiimage(data:imgdata) }
how big image? , downloading 1 image or array?
this might caused size of image trying download.
my advice if trying show image, giving url so:
let url = url(string: "http://i.imgur.com/w5rksij.jpg") let data = try? data(contentsof: url) if let imagedata = data { let image = uiimage(data: data) }
even better can try use asyncimageview 3rd party library give url of image , shows asynchronously without delays in app.
hope helps!
Comments
Post a Comment