Lot of strange leaks in instruments only on device (no leaks in simulator)

一世执手 提交于 2019-12-06 03:16:10

Threads aren't the real problem. It's the "text" property of UILabel.

cell.textLabel.text = product.title;
cell.detailTextLabel.text = product.desc1;

This property can only be set on the main thread.

Call performSelectorOnMainThread instead:

[cell.textLabel performSelectorOnMainThread:@selector(setText:) withObject:product.title waitUntilDone:NO];
[cell.detailTextLabel performSelectorOnMainThread:@selector(setText:) withObject:product.desc1 waitUntilDone:NO];

Why don't you just remove the initWithArray: and use

NSArray *topLevelObjects = [[NSBundle mainBundle]
         loadNibNamed:@"SearchResultsTableViewCell"
         owner:self options:nil];

(and you have to remove the release and set nil line too)

// EDIT: try to set the owner:nil

Threads were making all the problems. I was doing forks all the time without returning to main thread. That was the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!