gpt4 book ai didi

swift - Firebase iOS 测试 Crashlytics

转载 作者:可可西里 更新时间:2023-11-01 01:08:27 30 4
gpt4 key购买 nike

我最近在我的应用程序中实现了 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 日志时,它没有记录崩溃。我的实现有问题吗?

最佳答案

您需要确保您没有在激活调试器的情况下运行。

enter image description here

文档明确说明了这一点 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.

关于swift - Firebase iOS 测试 Crashlytics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52307931/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com