【问题标题】:Fixing generic Swift Crashlytics bug修复通用 Swift Crashlytics 错误
【发布时间】:2016-05-26 04:46:05
【问题描述】:

我正在努力找出影响大量用户的错误的根源。我正在使用 swift 2.0 并配对了 crashlytics,但崩溃报告让我一无所知! :

EXC_BREAKPOINT 0x00000000e7ffdefe

NewGroupShareInstructionsViewController.swift 第 48 行 NewGroupShareInstructionsViewController.(dismissImageView(UIGestureRecognizer) -> ()).(closure #1)

这是相关代码(如果您想要更多,请告诉我)

@IBAction func butPreviewPressed(sender: UIButton) {
        let imageView = UIImageView(image: UIImage(named: "Step\(sender.tag)"))
        imageView.frame = self.view.frame
        UIApplication.sharedApplication().keyWindow?.addSubview(imageView)
        imageView.frame = CGRectZero
        imageView.center = sender.center
        let recognizer = UITapGestureRecognizer(target: self, action: "dismissImageView:")
        imageView.addGestureRecognizer(recognizer)
        imageView.userInteractionEnabled = true

        self.lastButtonPressed = sender
        UIView.animateWithDuration(0.25) {
            self.navigationController?.setNeedsStatusBarAppearanceUpdate()
            imageView.frame = UIScreen.mainScreen().bounds
        }
    }

func dismissImageView(recognizer: UIGestureRecognizer) {
        let imageView = recognizer.view!
        UIView.animateWithDuration(0.25, animations: {
            imageView.frame = CGRectZero
            imageView.center = self.lastButtonPressed!.center
        }) { (completed) in
            if completed {
                self.lastButtonPressed = nil
                imageView.removeFromSuperview()
                self.navigationController?.setNeedsStatusBarAppearanceUpdate()
            }
        }

    }

希望有人能帮我解决这个问题!

谢谢

【问题讨论】:

    标签: ios swift crashlytics


    【解决方案1】:

    你有很多力量展开 (!)。我建议您改用 if let 语句 - 这些展开中的任何一个都可能导致您的崩溃。我最好的猜测是它是 self.lastButtonPressed! 调用,因为日志说它在第一个闭包中,就是这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多