【发布时间】:2020-02-25 16:28:04
【问题描述】:
我在第29行设置断点,想通过LLDB修改值让他进入==1的情况,结果发现这个断点没有打到就跳到了第33行,很奇怪。
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let v = UIView.init(frame: CGRect(x: 100, y: 100, width: 300, height: 300))
v.backgroundColor = .yellow
view.addSubview(v)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let value = test()
print(value)
}
func test() -> Bool {
let m = 3
29 if m == 1 {
print(m)
return true
} else {
33 print(m)
return false
}
}
}
Where the breakpoint hit 29 but But the breakpoint jumped to line 33 without hitting
当我将m的值设置为随机数时,断点可以停留在第29行,修改值可以让他进入不同的状态,这让我很困惑
func test() -> Bool {
let m = arc4random()
if m == 1 {
print(m)
return true
} else {
print(m)
return false
}
}
【问题讨论】: