DerFlickschter DerFlickschter - 1 month ago 4
Swift Question

Xcode 8 Breakpoint in file not working

I have one file,

SignInViewController.swift
, in my Xcode project that out of nowhere has begun not stopping on breakpoints. I have a breakpoint in
viewDidLoad()
and a few in
viewDidAppear()
. I have several
print()
calls in both functions to make sure they are executing. Breakpoints work fine in other files including
AppDelegate.swift
.

There was a point when I trying to figure out what was wrong where I noticed that while I was building the project an error would appear saying
Invalid redeclaration of 'signInViewController.swift'
and then go away before the build finished and the app would run fine, except for the breakpoints in the file.
signInViewController.swift
is the old name of the file from months ago before I renamed it to
SignInViewController.swift
. I haven't seen it before until the breakpoint issue occurred and since I have cleaned the project's build folder and Xcode's derived data I have been unable to replicate. I have a feeling that it is factoring into the problem but I am not sure how/why.

Anyways, here is things I've tried already. Most of them are just for breakpoints not working in general but I figure I should list them anyways even though that is not the case:



  1. Clean Project

  2. Clean Build Folder

  3. Clear Xcode's DerivedData

  4. Making sure breakpoints are enabled (Cmd Y)

  5. Build Settings are set to Debug

  6. Always Show Disassembly enabled and disabled

  7. Debugging enabled in run config




Any help would be very much appreciated.

UPDATE 1 (still no luck):



  1. Tried deleting the Xcode preference as suggested by neprocker's answer here




UPDATE 2:

I have isolated the breakpoint issue to just
viewDidLoad()
and
viewDidAppear()
breakpoints elsewhere in the file are working.

UPDATE 3:

Isolated to a specific block of code in
viewDidLoad()
.
viewDidAppear()
still not working though.

Answer

I'm not really sure how this ended up fixing it but I isolated the issue to a specific block of code in viewDidLoad(). Then I commented out that code and built and ran the project. Then I uncommented the code and built and ran it again and the breakpoints worked.