Xcode: EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)
I ran across this issue today when testing some Swift code against an old iPad 2 (I think it's an iPad 2 -- it's model MD368LL/A), running iOS 8.1.3. It turned out that the problem existed everywhere that I was calling something like:
Int(arc4random() % <someInt>)
This worked fine on later iPads, iPhone5S, iPhone6, etc. Fixed by changing code to:
Int(UInt32(arc4random()) % UInt32(<someInt>))
I think it was a register overflow on the older hardware.
I ran into this problem, in iPhone 5
, which is iOS 10.3.3
.
let date = Date()// Crashes in `iPhone 5`, but works in `iPhone 5s`.let time: Int = 1000 * Int(date.timeIntervalSince1970) //< Crash due to cast `Double` to `Int`// This crashes in `iPhone 5`, and `iPhone 5s` too.let time: Int32 = 1000 * Int32(date.timeIntervalSince1970)// It works fine in `iPhone 5`, and `iPhone 5s`.let time: Int64 = 1000 * Int64(date.timeIntervalSince1970)
In my case, this ended up being from a bit overflow issue if you cast too large of a number into too small of a type. E.g. Int(someNumber)
if someNumber
was an Int64
type.
iPhone 5c break at the offending line of code: