uitableview - iOS Haneke - memory warning then crash -


enter image description here

i developing app fetches images twitter using haneke library. once images, display them using uitableview. fetch 10 pictures @ time. app loads crashes due memory leak.

the code using set images follows.

var tweetimage = "http://pbs.twimg.com/media/cge89eqwqaacbxr.jpg"  if let var urlstring = tweetimage {   var url = nsurl(string: urlstring)   cell.tweetimage?.sizetofit()   cell.tweetimage?.hnk_setimagefromurl(url!) } 

when comment out last line cell.tweetimage?.hnk_setimageurl(url!) no longer receive memory warnings , not crash.

this first app have ever worked on or made, best way go fixing memory problem? or possibly using haneke library wrong?

thanks in advance, above output instruments if helps.

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     var cell= tableview.dequeuereusablecellwithidentifier("tweetcell", forindexpath: indexpath) as! tweettableviewcell      if (indexpath.row % 2 == 0){         cell.backgroundcolor = uicolor.whitecolor()     }else{         cell.backgroundcolor = uicolor(red: 0.973, green: 0.973, blue: 0.973, alpha: 1)     }      var row = self.results[indexpath.row]      var text = row["text"].string     var name = row["name"].string     var image = row["image"].string     var avatar = row["avatar"].string     var votes = row["rank"].int     var long = row["long"].string     var lat = row["lat"].string     var id = row["id"].int      var tweetimage = image == nil ? avatar : image      if let urlstring = tweetimage {         var url = nsurl(string: urlstring)         cell.tweetimage?.sizetofit()         cell.tweetimage?.hnk_setimagefromurl(url!)     }      return cell } 

above cellforrowatindexpath method, far working images. self.results loaded api alamofire library

i removed cell.tweetimage?.sizetofit() original code , works. not sure why had code in there in first place removing resolved memory leak issue. if knows why misuse of cell.tweetimage?.sizetofit() in context cause memory leak love know.

correct code:

var tweetimage = "http://pbs.twimg.com/media/cge89eqwqaacbxr.jpg"  if let var urlstring = tweetimage {  var url = nsurl(string: urlstring)  cell.tweetimage?.hnk_setimagefromurl(url!) } 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -