Firebase iOS 测试 Crashlytics
Firebase iOS testing Crashlytics
我最近在我的应用程序中实现了 Crashlytics,并使用以下方法实现它:
import UIKit
import Crashlytics
class ViewController: UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type: .roundedRect)
button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
button.setTitle("Crash", for: [])
button.addTarget(self, action: #selector(self.crashButtonTapped(_:)), for: .touchUpInside)
view.addSubview(button)
}
@IBAction func crashButtonTapped(_ sender: AnyObject) {
Crashlytics.sharedInstance().crash()
}
}
测试时,应用程序崩溃并出现错误 Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
,当我检查 crashlytics 日志时,它没有记录崩溃。我的实现有问题吗?
你需要确定你没有运行调试器激活。
文档明确说明了这一点
Test Crash
Keep Xcode’s debugger disconnected and after causing the crash, relaunch your app. Crashes are sent after it’s been launched following a crash, so be sure to place this line outside your App Delegate’s didFinishLaunching method. Keep in mind that exceptions are not guaranteed to cause a crash.
和
Using the Simulator to test your app? Xcode’s debugger prevents us from capturing crash reports, but if you disconnect the debugger, then we’ll be able to capture them. Note that if your device is plugged into your machine, the debugger can still get in the way. To make sure Xcode’s debugger is disconnected.
我最近在我的应用程序中实现了 Crashlytics,并使用以下方法实现它:
import UIKit
import Crashlytics
class ViewController: UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type: .roundedRect)
button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
button.setTitle("Crash", for: [])
button.addTarget(self, action: #selector(self.crashButtonTapped(_:)), for: .touchUpInside)
view.addSubview(button)
}
@IBAction func crashButtonTapped(_ sender: AnyObject) {
Crashlytics.sharedInstance().crash()
}
}
测试时,应用程序崩溃并出现错误 Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
,当我检查 crashlytics 日志时,它没有记录崩溃。我的实现有问题吗?
你需要确定你没有运行调试器激活。
文档明确说明了这一点 Test Crash
Keep Xcode’s debugger disconnected and after causing the crash, relaunch your app. Crashes are sent after it’s been launched following a crash, so be sure to place this line outside your App Delegate’s didFinishLaunching method. Keep in mind that exceptions are not guaranteed to cause a crash.
和
Using the Simulator to test your app? Xcode’s debugger prevents us from capturing crash reports, but if you disconnect the debugger, then we’ll be able to capture them. Note that if your device is plugged into your machine, the debugger can still get in the way. To make sure Xcode’s debugger is disconnected.