dequeueReusableCellWithIdentifier never returns

2019-08-02 22:15发布

When I call dequeueReusableCellWithIdentifier it is freezing my code and does never return any cell (or nil) I change the code from my custom class to a UITableViewCell to be sure the problem wasn't in my class, I also create a brand new empty cell to call with the identifier.

I add a log before and after the call for dequeueReusableCellWithIdentifier as you can see in the screenshot the one before gets called once and the one after never.

enter image description here

I try to clean and build, clean the project folder, delete DerivedData, restart the computer. I can't see any exceptions or what is really holding the code.

Any suggestions?

2条回答
Rolldiameter
2楼-- · 2019-08-02 22:40

I am not sure what happened to XCode, but, if someone find the same problem here is what I had to do.

I didn't find anything wrong with the cell (yes I was using storyboard and the identifier was set correctly) and noting was wrong with the code in the custom class as well. I even went to the point of create a secondary custom class and custom cell and it did not help, so I try to put a invalid identifier and even there XCode did not return me an error (as it should).

I had to delete my custom cell from the storyboard, as soon as I did that all start to work again, first the error that the identifier didn't exist, than the temporary one start to work, than I recreate the original one (exactly as before) and all start to work again.

Very overkill but worked for me. Thanks for all the help!

查看更多
Viruses.
3楼-- · 2019-08-02 22:44

It is expressed that you are printing println("return dequeueReusableCellWithIdentifier"), but can't see your return cell code at the end of your function, that must conform to your function expectation.

查看更多
登录 后发表回答