I have this class:
class IdentifiableModel: KeyValueModel {
class var OBJECT_ID: String { return "object_id" }
override init() {
super.init()
self.setRandomId() // Breakpoint 1 HERE
}
override init(dict: Dictionary <String, String>) {
super.init(dict: dict)
self.setRandomId()
}
var objectId: String?
func getObjectId() -> String? {
return nil
}
func setObjectId(value: String) {
}
private func setRandomId() {
if getObjectId() == nil { // Breakpoint 2 HERE
setObjectId("(Int(arc4random()))")
}
}
}
Instantiate a variable
var obj = IdentifiableModel()
Steps to reproduce:
1) Pause on breakpoint 1
2) Continue to breakpoint 2
3) Step over multiple times.
In most of the cases the program will show EXC_BAD_INSTRUCTION (code=EXC_i386_INVOP)
on the line with Breakpoint 2.