UITextView startInteractionWithLinkAtPoint crash iOS 11 only

后端 未结 2 1934
遥遥无期
遥遥无期 2020-12-10 16:20

So I experience crash in UItextview while user interacts with URL link there. All crash reports have iOS version 11 only. This looks like well-known bug in iOS 9, but there

2条回答
  •  一整个雨季
    2020-12-10 16:58

    I experienced and solved this problem.

    This is workaround in my production code. Disable interaction .preview state because of crashes only this state occurs.

    func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
        switch interaction {
        case .presentActions, .invokeDefaultAction:
            return handleLinkURL(url: URL)
        case .preview:
            return false
        }
    }
    

提交回复
热议问题