简体   繁体   中英

Accessory Detail Button on Custom Table View Cell ⇒ Memory Leak

I have a demo project on GitHub that is demonstrating a memory leak in iOS 13.5 with Accessory Detail Buttons on Custom Table View Cells .

This is a very simple app that I've built just for demonstrating this problem—however you could easily recreate it yourself:

  1. Create Single View App XCode iOS Project
  2. Embed existing View Controller inside a Navigation Controller
  3. Add a TableViewController and a Segue from ViewController to TableViewController
  4. Subclass UITableViewController and UITableViewCell
  5. Set classes in Interface Builder
  6. Set Reuse Identifier
  7. Set Cell Accessory to Detail in Interface Builder
  8. Add dummy data
  9. Configure cell

The memory is leaking on the TableViewController . Just navigate to the TableViewController and then back to the ViewController .

I'm not sure why I'm running into this leak. The project looks just fine to me. Am I doing something wrong or is this a bug in iOS? Custom Table View Cells should be supporting Accessory View—right?

Encountered same problem when using the detail accessory or the detail disclosure accessory in storyboard for a cell.

I removed all other code (basically a blank controller) and the error persisted until I removed the detail accessory or the detail disclosure accessory in storyboard. Checkmarks and disclosure accessories didn't produce the error.

When I added the detail accessory in the Tableview cellForRowAt function the memory leak wasn't present. So probably a problem with storyboard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM