找不到這個泄漏。 2個小時後,我訴諸你的幫助。來自libswiftCore.dylib的UITableviewController內存泄漏
當我回到我的tableview時,我一直在泄漏。我正在使用自定義的tableview單元格。
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! ClientTableViewCell
var client = SharedData.sharedClientList[indexPath.row]
//cell.fillData(client)
cell.nameLabel.text = client.clientName
var tempNeeds = client.needsAsOneStringList()
var multipleWord = tempNeeds.removeAtIndex(0)
var others = " | ".join(tempNeeds)
cell.needLabel.text = "\(multipleWord) \(others)"
cell.foundAddressLabel.text = "Map Location: \(client.placemark.subThoroughfare) \(client.placemark.thoroughfare) \(client.placemark.locality) \(client.placemark.postalCode)"
cell.expectedAddressLabel.text = "Searched Location: \(client.importedAddress)"
cell.hidden = false
cell.accessoryType = .None
if !client.isBase {
if client.clientsBaseAssociation != nil {
cell.hidden = true
}
}
else {
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
cell.expectedAddressLabel.text = ""
cell.foundAddressLabel.text = "\(client.placemark.subThoroughfare) \(client.placemark.thoroughfare) \(client.placemark.locality) \(client.placemark.postalCode)"
}
return cell
}
我確實有自定義單元格內的fillData方法,但再搬出來,因爲我以爲我可能是原因 - 它不是。這裏是小區
import UIKit
class ClientTableViewCell: UITableViewCell {
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var needLabel: UILabel!
@IBOutlet weak var expectedAddressLabel: UILabel!
@IBOutlet weak var foundAddressLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}
的iOS 8.4/6.4的Xcode
更接近問題
通過排除法,是不是一定要在'client.needsAsOneStringList()'?其他所有東西都在堆棧中或連接到可重用的單元屬性。外界可能沒有足夠的背景來解決這個問題。用ARC,一定不能是一個強大的參考週期? – BaseZen
會嘗試..並更新你 – DogCoffee
是否有那些「棘手」的計算屬性? – BaseZen