Reputation: 1398
Shortly after updating to Xcode 13.2.1 I started seeing some weird behaviour of breakpoints. When I run an app (in a simulator) some of my breakpoints change their look and turn to dotted blue outlined. Xcode does not stop execution at these breakpoints although code has been compiled, loaded and executed. I checked it in Console by adding some print
s.
When I hover over breakpoint Xcode shows a message:
Xcode won't pause at this breakpoint because it has not been resolved Resolving it requires that:
- The line at the breakpoint is compiled.
- The compiler generates debug information that is not stripped out (check the Build Settings).
- The library for the breakpoint is loaded.
All trivial solutions like reloading, reapplying breakpoints have not helped.
Did anybody else see something like this? Is there a way to solve it?
Screenshot for reference:
Upvotes: 33
Views: 17571
Reputation: 1
In my case I clear Xcode junk files then breakpoint not work. Here is what I have do:
** What I have test is if u keep track breakpoint on old iOS version it won't work but it will work on new download iOS version.
Upvotes: 0
Reputation: 2078
I have the same problem when using iOS Simulator (iOS 16.1). And when I change to iOS 17.2, the issue is solved.
Upvotes: 1
Reputation: 131
Conclusion:
changing simulator fixed it for my case
Details:
I want to clarify my case and then what fixed the issue for me.
I had to update to Xcode 15.1 then breakpoints stopped working for no reason, I tried all possible solutions I found but none worked, for example (restarting xcode, deleting derived data, removing all points adding them again, checked all debugging configurations, etc..)
usually before updating to Xcode 15.1 (then 15.2 trying to fix the issue but didn't work), I was developing using simulators iPhone12 (iOS 15) & iPhone s6 (iOS 15), at both the break points didn't work so I never thought the simulator is the reason, however in a disparate trial, I tried to run on iPhone 15(iOS 17.2 -> the default simulator with the Xcode version) and it worked just fine!!!
Upvotes: 13
Reputation: 513
Make sure that the file in which you are adding breakpoint is having correct target set in target membership.
Upvotes: 5
Reputation: 31
What worked for me, was to select the files, delete them with - Delete>Move To Trash - and then drag the files back from the trash to the project.
I edit the answer because I've seen that if you have some strange character in the path to the file (some group name for example), the breakpoint is not resolved either.
I hope it helps
Upvotes: 3
Reputation: 81
Go to Build Settings, Find Generate Debug Symbol then set to YES
Upvotes: 4
Reputation: 371
In Xcode 14 the problem is much more prevalent and "consistent". I figured out one pattern where it always fails and how to mitigate it. If you have a final class then breakpoints set on or inside a private method will have that issue. If you remove private from the method or final from the class the breakpoints will get resolved properly.
Upvotes: 2
Reputation: 278
My case
Working on framework development. Framework is injected into the sample app for development/run purpose. Breakpoints inside the framework won't work.
Fix
Just removing xcframework in sample app and replacing with framework.
Reason
xcframework are precompiled outside of the app, so lib isn't compiled when project is built and that's why breakpoints doesn't work.
Upvotes: 0
Reputation: 2085
For my case somehow the code path was never invoked and very likely considered as dead code. The same thing applies when not adding the file to the target that you want to debug.
This can be the case or somehow debugger might not be able to resolve your breakpoint. The first thing in this case should be cleaning derived data and any caches.
But instead of recloning your repo you can just delete breakpoint config from the location described in this answer
Upvotes: 1
Reputation: 317
I just passed through this problem and the solution for me was recreating the files.
Note: The ones I was trying to originally breakpoint on were copied from another project. When I created the new files, even though their Identity and Type looked just the same (target membership, encoding, paths), for some reason breakpoints started to work again.
Note 2: When copying and pasting code to your new files (if done manually), migrated breakpoints - created in the older file - will continue to fail. Only the ones created in this new file will work properly.
Hope it helps.
Upvotes: 0
Reputation: 2180
If tried everything and nothing worked I suggest the following:
This is what worked for me.
Upvotes: 0
Reputation: 573
In my case the issue was happening, because class was not added to the target, which I was trying to build.
Upvotes: 1
Reputation: 1398
Ok, so in my particular case rebooting laptop has helped. All breakpoints are now good. But it would still be nice to know the cause of the problem.
Upvotes: 3