SWIFT Crashlytics exc_Breakpoint错误含义 [英] Swift Crashlytics EXC_BREAKPOINT error meaning

查看:63
本文介绍了SWIFT Crashlytics exc_Breakpoint错误含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firebase Crashlytics中看到此报告:

但我想不出这是什么意思?我实际上有5个不同的开放错误,但它们看起来都像这个例子!始终存在17个意愿列表DropDownForWebView,并且始终为exc_Breakpoint

另一个例子:

有人能给我解释一下这是什么意思吗?知道我怎么才能修好它吗?相当烦人...

该应用程序目前处于活动状态:

https://apps.apple.com/us/app/wishlists-dein-wunschzettel/id1503912334

我为每一个人的帮助感到高兴!

更新

我的DropDownView

//MARK: DropDownView
class DropDownViewForWebView: UIView, UITableViewDelegate, UITableViewDataSource  {

var dropOptions = [DropDownOption]()

var tableView = UITableView() // LINE 18

var delegate : DropDownProtocol!

var selectedWishlistDelegate: SelectedWishlistProtocol?

override init(frame: CGRect) {
    super.init(frame: frame)
我有一个处理URLstextView。这是我的助手函数,用于添加一个hyperlink

func hyperLink(originalText: String, hyperLink: String, urlString: String) {

    let style = NSMutableParagraphStyle()
    style.alignment = .left

    let attributedOriginalText = NSMutableAttributedString(string: originalText)
    let linkRange = attributedOriginalText.mutableString.range(of: hyperLink)
    let fullRange = NSMakeRange(0, attributedOriginalText.length)
    attributedOriginalText.addAttribute(NSAttributedString.Key.link, value: urlString, range: linkRange)
    attributedOriginalText.addAttribute(NSAttributedString.Key.paragraphStyle, value: style, range: fullRange)
    attributedOriginalText.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.darkCustom, range: fullRange)
    attributedOriginalText.addAttribute(NSAttributedString.Key.underlineColor, value: UIColor.darkCustom, range: fullRange)
    attributedOriginalText.addAttribute(NSAttributedString.Key.font, value: UIFont(name: "AvenirNext-Medium", size: 15)!, range: fullRange)

    self.linkTextAttributes = [
        kCTForegroundColorAttributeName: UIColor.darkCustom,
        kCTUnderlineStyleAttributeName: NSUnderlineStyle.single.rawValue,
        ] as [NSAttributedString.Key : Any]

    self.attributedText = attributedOriginalText
}

我怎么称呼它:

cell.linkTextView.hyperLink(originalText: "Open link".localized(), hyperLink: "Open link".localized(), urlString: currentWish.link)

currentWish.link可以是任何东西。不必是有效的URL。我在点击链接时进行验证。

推荐答案

崩溃发生在iOS隐藏代码中,就在调用UITextViewDelegate方法textView(_:shouldInteractWith:in:interaction:)之前。

this one是同一个问题。要复制您的错误,您可以在链接中放置韩文文本(한국어 텍스트,即根据谷歌翻译的韩文文本)、阿拉伯语文本(نص عربي,即根据谷歌翻译的阿拉伯语文本)等。您可以在Internet上搜索样本文本(即,不是a-z字符)。

发生了什么:

  • 设置:

    attributedText.addAttribute(.link, value: INVALIDSTRINGVALUE, range: linkRange)
    aTextView.attributedText = someAttributedText
    
  • 链接上的用户录音

  • 稍后将调用textView(_:shouldInteractWith:in:interaction:)

    的苹果内部代码
  • textView(_:shouldInteractWith:in:interaction:)

  • linkTappedCallbackClosure(url: URL)

  • openURL(_ urlString: String)其中:

    guard let url = URL(string: urlString) else {
        showInvalidUrlAlert()
        return
    }
    

所以您要检查URL是否有效,但为时已晚。代码在iOS代码内部崩溃。

因此,在使用hyperLink(originalText:hyperLink:urlString:)设置URL之前,请检查它是否是有效的URL(即URL(string: urlString) != nil),如果不是,请调用showInvaludURLAlert()

好,但这将只修复新条目,而不是使其崩溃的当前值。

要修复较旧的条目,您可以决定从数据库中删除所有无效的URL。但它可能会删除用户认为是标签或其他额外字段的信息。

额外的代码,可能:
循环访问您的数据库。
向您的数据库中添加一个布尔域";hasBeenFixed";。 对于每个无效的URL(表示URL(string: thatValue) == nil)),对其进行百分比转义。将hasBeenFixed的值更改为True
如果用户尝试点击该链接,它应该会避免崩溃(以进行验证)。
向用户显示该值时(编辑时),如果hasBeenFixed == true,则显示删除了转义百分比的值。然后,当用户尝试验证它时,将出现弹出警报,并需要修复它。然后在保存有效的URL时,将hasBeenFixed更改为false

这篇关于SWIFT Crashlytics exc_Breakpoint错误含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆