我是使用 Crashlytics 的新手。我已经开始探索使用日志记录并创建了一个示例 ios 项目来测试它。我能够看到 CLSLogv 命令的第一个参数,但缺少第二个参数
示例:CLSLogv("Button1", getVaList([1,2,3]))
“Button1”在日志文件中可见,但缺少 [1,2,3]
import UIKit
import Crashlytics
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
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)
CLSLogv("Button1", getVaList([1,2,3]))
write(string: "Button 1 initiated")
let button2 = UIButton(type: .roundedRect)
button2.frame = CGRect(x: 80, y: 60, width: 100, height: 30)
button2.setTitle("NewCrash", for: [])
button2.addTarget(self, action: #selector(self.crashButtonTapped1(_:)), for: .touchUpInside)
view.addSubview(button2)
CLSLogv("Button2", getVaList([10,20]))
write(string: "Button 2 initiated")
}
@IBAction func crashButtonTapped(_ sender: AnyObject) {
Crashlytics.sharedInstance().crash()
}
@IBAction func crashButtonTapped1(_ sender: AnyObject) {
var i = [0,1,2,3]
for k in i{
print(10/k)
}
}
func write(string: String) {
CLSLogv("Button", getVaList([string]))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}