简体   繁体   中英

_NSCFString tableView:heightForHeaderInSection:]unrecognized selector - Need help debugging

I am getting the following error message:

[__NSCFString tableView:heightForHeaderInSection:]unrecognized selector sent to instance 0xdc7e610]

It happens after:

-Clicking a button that pushes to view2 where I have 5 text boxes. When you click in a box the keyboard pushes the view up so you can see what you're typing.

-After clicking "done" on the accessory keyboard view the screen returns to normal. If I then click on the screen after a brief delay (following the screen returning to norm.) the app crashes with the above error message.

NOTE: view2 is a normal viewcontroller. View 1 is as well but has a small table view on it.

I've been trying to figure it out but havent been successful. Any help would be greatly appreciated!

Sounds like you have a zombie somewhere (an object that gets released while it's still in use. That can happen because a table view's delegate property is a weak link to the view controller.

If I had to guess I would guess that your view controller is being released, but your table view is not.

Run with the zombies instrument in instrument, or turn on zombies in the debug settings. (You should be able to find information/tutorials on both methods for finding zombies on the 'net.)

In this case adding the view as a subview has retained it, when you remove view controller, you still have a reference to the table view. but the view controller has been dealloc'd which is why the datasource (which is the view controller for UITableViewController) method is being sent to a deallocated instance.

I had a same problem. It was a problem with side menu. When view controller pop over, then first remove table view from the view that you are popping, then let menu controller to pop over that child controller.

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