Scrolling through UITableView causes Exception and Crash only on iPhone 5C

后端 未结 1 786
北荒
北荒 2021-01-19 05:27

There is an exception being thrown when a user scrolls through my UITableView too fast or taps the status bar to jump to the top of the table. I am only seeing

相关标签:
1条回答
  • 2021-01-19 06:15

    The bug is not in the code you posted. The bug happens when a UITextView is reused while its links are still being generated, which is done asynchronously.

    See these similar Stack Overflow questions:

    • iOS 7 UITextView link detection crash in UITableView
    • UITextViews in a UITableView link detection bug in iOS 7
    • UITextView link detection in iOS 7

    Many users have reported that setting the text view's text property to nil in the cell's prepareForReuse method resolves the issue. Alternatively you could use a library like TTTAttributedLabel instead of a text view.

    The fact that it only appears on an iPhone 5C is probably a red herring. I bet this device is still running iOS 7, and the other devices have been updated to a newer version of iOS.


    On a side note, there may be edge cases that your regex doesn't cover. I would delete your twitter parsing method and replace it with the official twitter-text-objc library.

    0 讨论(0)
提交回复
热议问题