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:
Clean Project
Clean Build Folder
Clear Xcode's DerivedData
Making sure breakpoints are enabled (Cmd Y)
Build Settings are set to Debug
Always Show Disassembly enabled and disabled
Debugging enabled in run config
Any help would be very much appreciated.
UPDATE 1 (still no luck):
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.
I had the same problem with an old project. Select Product(located at top menu bar) -> Scheme -> EditScheme and I solved this issue by clicking on "Debug Executable", as shown in Picture. Maybe this will help someone else too.
In my case breakpoint was not hit in just one callback, so I changed "Swift Compiler" "Optimization Level" to "No optimization" in project target build settings for debug, and it started working in Xcode 9.3 as well as AppCode.
Below patch is work for me. From the menu bar, select Product -> Scheme -> Edit Scheme -> Select Profile -> Set Build Configuration to BUILD. Please review below-attached screenshot.
I was also dealing with the same issue in xcode 9.
I resolved the issue in below ways:
Remove XCode defaults Using below terminal command
defaults delete com.apple.dt.Xcode.LSSharedFileList
defaults delete com.apple.dt.Xcode
Clear(or delete) Xcode's DerivedData from
/Users/[Your Mac Username]/Library/Developer/Xcode/DerivedData
Delete(or uninstall) Xcode.app from Applications and then restart PC
Install fresh copy of Xcode 9
[Mandatory] Set user permission to your app project like
chmod -R 777 "/Users/[Your Mac Username]/Desktop/TestApp/"
[where TestApp is the app project keeping on Desktop]
Open the project and check Build Settings are set to Debug
Make sure breakpoints are enabled and set debug point in your code
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.
What helped for me was deleting the file Breakpoints_v2.xcbkptlist which is located under the project directory (*.xcodeproj) in the directory: xcuserdata/Fred.xcuserdatad/xcdebugger (replace "Fred" with your username). Use a terminal program to go there.
I solved this by going to my Xcode project's 'Build Settings' and setting 'Generate Debug Symbols' to 'Yes'
Sometimes the values may have changed in Xcode userdefaults itself,
At times, I had similar issue with debugger stopping at stacktrace
Few ways to clear this
1.Delete the Xcode preference
defaults delete com.apple.dt.Xcode
Other Issue could be the optimization level for the target, changing it to none will stop at the debugger
In my case, it turns out that the Dev build configuration is not configured properly.
The Dev configuration should be copied from Debug, not Release.
You can search with word debug in your Build settings to see the differences.
For example:
Hope this helps.
Open viewController.swift file for initial view in the standard editor and print something inside viewDidLoad and run application.. if the print is working properly, now make sure you have selected viewController.swift file correctly in the assistant editor.
Building up on what #neprocker said, I had "Optimize for Speed" for both debug/release. Simply changed the value for debug and I was good to go.
Related
None of my breakpoints are being hit.
I've tried the following:
Deleted Derived Data directory
Cleaned build folder
Deleted the xcuserdata directory
Made sure build configuration is Debug and Debug executable is
ticked
Made sure Generate debug symbols is set to Yes
Changed Optimization level to No optimization
The breakpoints are still not being hit.
Had this exact issue today - breakpoints in Swift projects were failing in XCode 9.3 (objective-c ones were fine).
The following fixed it:
change Optimization level under the Swift Compiler - Code Generation submenu. Move it from -O to -Onone
src: https://www.reddit.com/r/swift/comments/89nht7/breakpoints_not_working_after_updating_to_xcode_93/?st=jftp4n02&sh=49688058
Try below steps
Go to debug (top bar in Xcode)
Debug Workflow
Always show Disassembly - uncheck it
None of the existing answers worked for me so I dug into what was going on. By forcing a breakpoint in code (i.e. an asm("int3;") instruction) I was able to see that the symbols weren't loading. Naturally breakpoints depend on symbol information being loaded.
The code for which my breakpoints weren't working was in a C++ framework and the framework has a build setting called "Strip linked product" which was defaulted to "Yes" for both release and debug builds. By setting this to "No" for the debug build (and doing a full rebuild) my breakpoints now work again.
I had set Deployment Postprocessing to NO in my Build Settings for my target. Setting this to YES made my breakpoints work again.
In my case problem was in the Debug information format setting. It was set to DWARF instead of DWARF with dSYM File. Reseting it to the default value solved the problem.
I was facing the same issue and this solution works for me:
Open project settings
Optimization Level
Under "Swift Complier - Code Generation" Section
Set "Optimization Level" to No Optimization[-Onone]
Refer attached screen shot
Check Preferences > Behaviors > Running > Pauses options.
The Show for navigator and debugger must have ticked.
Select breakpoint tab in XCode delete all the old breakpoints.
Then add new breakpoints. It worked for me.
None of the previous solutions worked for me either. I had an issue where all my breakpoints would work except on a c++ project among other projects in an xcode (9.4.1) workspace. For that project, I noticed that only some breakpoints were working. Digging deeper showed that it was breakpoints made within private methods that did not work.
After a good deal of investigation, I found my particular issue. In my main project, I had declared some static objective-c initializers in a header file. Not entirely sure why, but after I moved these to the implementation file where they were referenced, my broken breakpoints started working again. Hope this saves someone some time.
Setting Build Active Architecture Only to Yes helps me.
Set Deployment Postprocessing to "Yes" in my Build Settings for my target.
Debug -> Debug Workflow -> Always show Disassembly -> Uncheck
Quit Xcode and reopen the Xcode.
I have an Xcode project which includes a sub project. After upgrading to Xcode 7 breakpoints in the sub project are not hit nor can I step into functions calls of the sub project. Some breakpoints do get hit but they just show assembly for the call so it seems the sub-project is not being symbolicated correctly. I've checked all the usual sort of things i.e. is generating debug symbols, build configuration on debug is not release and things of this nature shown in Xcode project settings. Anything else I might be missing? In Xcode 6.4 this was not an issue.
This was an issue with not having the correct debug information format set in the hosting project. I resolved by creating a dummy/test Xcode project and comparing the debug file format detailed for each configuration to that in the trouble making project changing the debug information format to match the dummy/test project.
In some case this issue can be related with broken link between the breakpoint and the Project/file.
So try to remove the breakpoint and re adding it.
Xcode 6 is completely ignoring my breakpoints. I saw a post here from 2008, but the answers are outdated, and don't seem to work.
EDIT:
This is happening only with projects that I start. All my downloaded open source projects work perfectly fine, as well as projects I started a few months ago.
UPDATE:
This is what I get when I create a brand new project and set a breakpoint in viewDidLoad
After trying many different things, I ran
defaults delete com.apple.dt.Xcode
This reset my Xcode settings. Now when I create a new project, breakpoints work fine.
I realized that the problem happened when I added Cocoapods to the project. B/c right after I ran pod install, breakpoints stopped working. I'm not sure why.
Hope this helps anyone with the same problem
I had a similar issue when I added a target to my project. Breakpoints placed in that target were ignored.
The solution was to set "Debug Information Format" in the new target's build settings to "DWARF with dysm"
In XCode 7.1 it defaulted to DWARF
There can be various culprits for this, a common one being setting the build scheme to Release instead of Debug.
For me it was the Debug Optimization Level set to -O0 in my target's build settings. Changing it to "Fast [-O, O1]" makes Xcode breakpoint-respectful again.
There is an interesting post about it here:
http://blog.credland.net/2014/03/xcode-debugger-why-do-you-stop-working.html
Close Xcode and remove the derived data and then reopen Xcode it will work
I get this error when building my app in the latest version of Xcode:
fatal error: malformed or corrupted AST file: 'Unable to load module
"/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm":
file not found' note: after modifying system headers, please delete
the module cache at
'/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP'
1 error generated.
When I navigate to:
/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache
I can see that the directory 'XYZYIE6ZV0OP' doesn't exist.
Does anybody know how I can resolve this? I cannot delete anything at the directory as suggested in the 2nd part of the error message as that directory doesn't exist!
Had same problem. Clearing derived data folder solved the issue for me. In Xcode, go to Window->Organizer->Projects, select your project, and press the "Delete..." button next to "Derived data".
If this doesn't work, you can try to do a Product->Clean (Cmd+Shift+k).
Press Command + shift + k or clean the project and then run project...
In Xcode select Product-->Clean problem will be solved
By default Library folder is hidden in Mac. Best way to navigate to that folder is :
Open Finder
Select Go from menu -> Select "Go to folder"
Type : /Users/"your user name"/Library/Developer/xcode
This will open direct xcode folder inside hidden library folder.
Select "DerivedData" folder
Command + A, select all and delete them.
Open Simulator and "Reset Content and Settings".
Now run XCode again, all will fix.
I had the same issue, solved it by cleaning the project.
Product-> Clean
or press
command+shift+K
In my case, I accidentally modified NSURLConnection.h. Xcode complained about cache at path
/var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/5.0.2-5A3005/Xcode/ModuleCache/XWWWZ5ED888F
I finally found the steps to fix it:
Quit Xcode
Delete the upper "5.0.2-5A3005" at
/var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005
When Xcode restarted, it regenerated that folder and everything in it.
I had the same issue ever since installing the latest SDK.
My solution was to delete the derived data and clean the project.
I got same error on executing xcodebuild command of Xcode6-beta5.app coexisting with Xcode.app (Xcode 5).
In this case I added -derivedDataPath to separate ModuleCache from the one for default Xcode.app.
xcodebuild -derivedDataPath ./build/Xcode6-beta5/DerivedData ....
This works for me.
I tried deleting derived data and Clean project several times and it doesn't work. The file in my warning is an old file I already deleted from Project Navigator and all the Build Settings. But it keeps showing up and gives me this error. The error only occurs on Simulator, but not on device. Which is really really weird. :/
For some reason, I switched branch to some other branch and switch back and it works again. If anyone even know how that could work please tell me :D
Simply clean remove the Derived Data and build folders. The problem shall be resolved.
In my case the SSD was broken.
You can verify the disk with apples Disk Utility
In my case I had a spaces in my plist file name.
I removed it, and changed Info.plist File key in target Build Settings
Refreash Safari browser, scroll down the page and you will see you "Click + button for add build ..." then add actual build, click Save and "Waiting for Review"
Cleaning the project and deleting the drive data didn't fix it for me. But what finally fixed it was changing the model of simulator that I used.
So first do a clean, then if you were running it on iPhone 5 simulator, run it on iPhone 5s simulator to fix the issue. basically, run it on any other simulator other than the one you were running.
(Credit to Hlung for his answer, I hope this one is a bit more clear)
If you have your project scheme set to "Wait for executable to be launched" this error might happen.
In that case, just changed your scheme from Product > Scheme > Edit Scheme...
In my case, I tried to archive a app in one project within a xcodeworkspace
close Xcode, the open the single target project, and clean an
Then, I do archive, it makes an iOS App archive.
I hope I can help someone.
Got this error while trying to build a third-party app for the first time. Adding foundation as a library fixed the issue for me.
I did Clean cached, Delete derived data, Manually delete the Module cache folders which found from the error logs, Restart xcode, Restart machine.
But non of them helped me.
But this steps help me to resolve the issues
Comment out all the #import line in [Name]-Prefix.pch files.
Build, as expected its pointing me to different errors.
Revert back the changes I have done in [Name]-Prefix.pch and Build, compilation succeeded.
This solution help me to resolve the issue.
if you can't find your "Derived data"
File -> Workspace settings
Click on the arrow icon next to your path
Remove "Derived data" folder
tried to re-install XCode which didnt resolve the issue, also created a new local user account & get the same error so in the end I gave up & restored to a time machine backup from a few days before... seems to be ok again... for now!
I was running my application without any problems on both the simulator and device. All of a sudden i get this error:
fatal error: file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionView.h' has been modified since the precompiled header '/Users/rashidasgari/Library/Developer/Xcode/DerivedData/ModuleCache/SWBH8ZAWBXAH/UIKit.pcm' was built
note: after modifying system headers, please delete the module cache at '/Users/rashidasgari/Library/Developer/Xcode/DerivedData/ModuleCache/SWBH8ZAWBXAH'
I tried any solution i could find and still no luck. Note that i tried running the application on another MacBook and everything works fine without any errors.
Cleaning the project is the first port of call (menu under Product).
If that doesn't help, delete the derived data. That can be done via the Locations section of the preferences or by navigating to the directory in Finder and deleting it (there is a little -> button in preferences to get there, or use Go To Folder... option in the Finder.
Ok after trying almost every solution on web, i decided to reinstall xcode and it finally worked.
I solved this problem by changing DerivedData folder name..see how i did
Xcode->preferences->Then you will be redirected to preferences screen
Then click on locations tab under menu selection->then you will have options like Derived data,snap shots ,archives
under Derived data you can see some thing like /Users/SENABI/Library/Developer/Xcode/DerivedData-> then click on that arrow button that's it there you can see DerivedData folder click on that and rename it. your error will be removed.
This is my experience and it worked for me hope it will be helpful to someone.
Error occurs when system header files are modified.
Solution :
If you have the backup of XCode then reinstall the XCode (Better solution).
Delete the DerivedData folder and then build the project
Use CMD+Shift+K to clean the build and then relaunch. This should solve the issue.
you don't have to delete anything.
you messed up a git pull somewhere probably. just quit Xcode and the simulator, reset any changes (or stash them) try another git pull, start Xcode again, clean your project and run it again.