Are Swift conditional breakpoints broken in Xcode 8.2?
Asked Answered
N

0

6

I just tried to create a conditional breakpoint in the XCODE GUI by clicking to add a breakpoint, then editing it and entering an expression in the Condition field. However, the breakpoint always triggers.

I finally distilled it down to entering true or false into the condition field, and even that doesn't work.

Curiously, setting a conditional breakpoint on a line of Objective-C in the same (mixed Swift/Objective-C) project does work.

It looks to me like breakpoint conditions are completely ignored when the breakpoint is in your Swift source code.

Are other developers seeing the same problem? Is there some "secret sauce" to getting Swift breakpoints to work that I am missing?

Nidianidicolous answered 14/4, 2017 at 16:44 Comment(9)
It works for me. I tested it with a simple for i in 1...10 loop and added a breakpoint condition i == 4. Can you show a minimal code example and the output of "breakpoint list" in the debugger console? – However, I am using the current Xcode 8.3.1, perhaps this has been fixed.Beadruby
@MartinR, thanks for checking. The app in question is a HUGE hybrid Objective-C/Swift app for my client that contains multiple custom Cocoapods and lots of other complexity. (The breakpoint I'm dealing with is in the main bundle however.) I just tried to create a new app and the conditions are working fine. I then created a hybrid Objective-C/Swift iOS app, and conditional breakpoints work there too. So it's something about this app's workspace that's causing the problem. I'll have to do more digging.Nidianidicolous
The client is still on Xcode 8.2.1, and won't upgrade to 8.3 for at least a couple of weeks (We have third party frameworks that will have to be rebuilt to support 8.3/Swift 2.1.)Nidianidicolous
I tried 1 == 1 and it breaks every time, good... then I tried 1 == 0 and it breaks every time... okeydokey, the Bistromathic Drive must be engaged on my Mac...Mercola
@WilliamCerniuk, sounds like you're seeing the same problem I am.Nidianidicolous
I have been relegated to putting if statements all over my code to build conditions and break on them because of this. Ya think tools would improve over time ... 1998 CodeWarrior ... Thou art missed!Mercola
I wonder if it's a bad state that projects/workspaces can get into? The fact that I see this on some projects but not others makes me think that that may be the case.Nidianidicolous
I have the same problems since Apple tried to apply Swift Code in the Conditions with auto-completion. (I think that may have been Xcode 8.2)Stereoscopy
Have the same problem here. Would you like asking this also on apple.stackexchange.com? I can copy if you are happy with it.Polestar

© 2022 - 2024 — McMap. All rights reserved.