Search code examples
swiftxcodebreakpoints

xcode creates breakpoint for no reason


Im doing a bit of practice coding in Swift, trying to work it all out and learn as I go, I know how to stop the breakpoint from occurring but im wondering why it happens all the time and if its possible to stop it permanently.

if the activate breakpoints button is turned on (and it seems to turn its self on all the time), xcode won't load the app in simulator and instead breaks at this line

let snakeHead = SKSpriteNode(imageNamed: "snakehead1.png")

now as far as I can tell there isn't anything wrong with the code, it sits within a function that does a few other things but other than that its pretty straight forward. As mentioned i can stop the breakpoint from occurring by deselecting the button but I'm just wondering why it keeps happening, is it something I've unintentionally done?

edit: screenshot added

enter image description here


Solution

  • In all probability, we break at this line when breakpoints are activated because you have in fact set a breakpoint at this line.

    If you don't want that to happen, delete or disable the breakpoint that is set at this line.