MaxKrissigo MaxKrissigo - 4 years ago 2214
Swift Question

Thread 1:EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe) Swift SpriteKit Error

I'm getting this error when I click my SKNode(SpriteKit Button): Thread 1:EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)

override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {

for touch: AnyObject in touches {

let location = touch.locationInNode(self)

if playButton.containsPoint(location) {

random()

}
}
}

Answer Source

Breakpoints in Xcode

This exception probably doesn't indicate a breakpoint you set, but here's an overview for those who aren't familiar.

In Xcode, a breakpoint is an object that points to a line of code for debugging purposes. In the code editor, clicking a line number adds a breakpoint to that line. A breakpoint, typically blue, looks like a small arrow-like rectangle over a line number. When you run your program and that line of code gets executed, the program will crash and lldb (Apple's debugger) will give you information about the variables in that scope. This is useful for seeing what is stored in certain variables and for checking that a block of code is being executed at all. By performing a secondary (right) click on a breakpoint and selecting "Edit Breakpoint", a developer can choose advanced options like allowing execution a certain number of times before crashing.

When you click your button, the code in that block is being executed, a breakpoint is hit, and the program aborts. This is probably not a breakpoint you set, but an internal one.

To remove a breakpoint, perform a secondary (right) click and select "Remove Breakpoint". Alternatively, you can choose to disable it. This will fade it out.

You can see an overview of your breakpoints in the Breakpoint Navigator.

Internal Breakpoints

This particular breakpoint indicates ARM and therefore makes me think it is an internal one with the ARM processor. Internally, iOS may provide breakpoints even when you did not set them.

32-Bit vs. 64-Bit

My guess is that your random() function is somewhere generating a 64-bit integer that will cause older 32-bit devices to crash.

Vastly simplified, the difference between 32 and 64 bit devices is about memory. Internally, when you create a variable or constant of any kind you are storing something in the device's memory. 64-bit processors are capable of accessing more memory than 32-bit ones. Additionally, 64-bit applications contain 64-bit data types.

Many Swift data types explicitly define various versions of themselves that are different bit-sizes. For example, Swift integers come in Int8, Int16, Int32, and Int64, plus unsigned versions of the same. Using Int64 on devices containing 32-bit processors will not end well. You should especially be careful about the unmarked Int type, which is effectively a typealias for Int64.

The Apple A7 processor in the iPhone 5s and iPad Air was the first 64-bit chip for Apple's mobile devices. Older devices will not play well with 64-bit data types. Note that iPod touch 5th gen contains an A5 processor and is 32-bit only, whereas iPod 6th gen contains an A8 processor and is 64-bit.

In your random() function, you should check for any random number generating functions that may returning an Int64 or even a plain Int. You also may be casting a value somewhere to one of these two types.

Refer to this similar StackOverflow question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download