我正在努力找出影响大量用户的错误的来源。我正在使用 swift 2.0 并配对了 crashlytics,但崩溃报告让我一无所知! :
EXC_BREAKPOINT 0x00000000e7ffdefe
NewGroupShareInstructionsViewController.swift 第 48 行 NewGroupShareInstructionsViewController.(dismissImageView(UIGestureRecognizer) -> ()).(关闭 #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()
}
}
}
希望有人能帮我解决这个问题!
谢谢
最佳答案
您正在进行大量的力展开操作 (!
)。我建议您改为使用 if let
语句 - 这些解包中的任何一个都可能导致您的崩溃。我最好的猜测是它是 self.lastButtonPressed!
调用,因为日志显示它在第一个闭包中,也就是这样。
关于ios - 修复通用的 Swift Crashlytics 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37451801/