Debugger is not working in Xcode 6.3.1 - xcode6.3.1

Since Xcode 6.3.1, with a Swift project (not Obj-C), if the name of the project folder contains one or more / slashes such as a date i.e SomeApp04/05/15 the debugger does not work correctly for me. It ignores (goes right past) breakpoints without stopping. Remove the slashes in the name of the project folder and the debugger works correctly.
Anyone else experienced this lack of function of the debugger?

Related

Xcode debugger displays incorrect values for variables

I previously asked a similar question here. This version has simpler example
UPDATED SUMMARY: Xcode is displaying "FAIL" in the debugger variable section for every String. Swift print() statements show correct variable values. All other data types are displaying correctly. How do I get back to a working executable?
Problem: Xcode is displaying incorrect values for variables. Originally this happened with one project. Now, EVERY project, including new projects, have incorrect variable values. Here is a screenshot demonstrating the issue in a new project (forgive my use of ViewDidLoad() as main()..)
Here's what I did: Delete Xcode.app (version 10.0). Download Xcode 10.1 from the App Store. Create a new project. Type in this code, and run.
This same problem occurs in existing projects in Xcode 9.4.1 and Xcode 10.0 -- same behavior as new installation of Xcode 10.1.
Since all versions of Xcode show same problem, I am assuming this problem is not in the Xcode executable, but in some cache or other temp file. I have cleaned my project, restarted Xcode, rebooted, etc. No help.
So my question is: How do I get a clean installation of Xcode? What directories can I delete to get to a working state? I am a novice. I have only test projects that I run in the iOS debugger or on OS X, so I am quite happy re-compiling all of my projects. Is there a complete list of temp files and directories Xcode uses?
Do I have to delete EVERYTHING Xcode has ever written to disk? I'm open to that if no other solution exists.
Thanks for any suggestions on how to proceed or how to gather more info...
I was able to solve this one after a LOT of guesswork.
I agreed with #Martin R that this didn't sound like a cache issue, since the problem persisted after downloading new versions of Xcode. I guessed that only preferences and UserData would out-live the new executable...
I reviewed the UserData directory, and found a subdirectory for the debugger:
~/Library/Developer/Xcode/UserData/Debugger/
In this directory was a file called "CustomDataFormatters". I don't know how the file got created, but here is its contents:
<?xml version="1.0" encoding="UTF-8"?>
<CustomDataFormatters
version = "1.0">
<SummaryFormatters>
<SummaryFormatter
formatString = "FAIL"
type = "Swift.String">
</SummaryFormatter>
</SummaryFormatters>
</CustomDataFormatters>
This file seems to set every string to "FAIL", which is the exact behavior I saw. Additional testing showed me that integers, floats, and other data types were displaying correctly -- it was only String type that was always incorrect.
Deleting this file solved my problem.
If anyone can explain how this file was created, I would appreciate it, but for now, I am able to debug again!
During app debug, I have right clicked on string variables to "copy" data, or "View Value as...". Did I hit some key sequence to create this file during degug?
Did I hit some weird keyboard shortcut while trying for a CMD+B or CMD+R??
Also, I changed the title of this issue to "Xcode debugger displays “FAIL” for all Strings" to help future searches.

How do I completely remove all Xcode program and cache files?

Created a new question here with simpler example.
I have encountered some odd behavior from Xcode, including giving incorrect variable values and giving me syntax errors in older projects that compiled fine when I left them.
What is the best way of getting back to a clean Xcode?
Are there issues having two (or more) Xcode executables in the Applications directory? I am only running one version at a time...
Is it possible to completely remove all program data files and cache files, as if I've never installed Xcode?
If not, is there a list of caches/etc that can be safely deleted?
Here's what I've tried so far, based on Stack Overflow searches:
Clean project (CMD+OPT+K). Restart Xcode. Reboot Mac
Downloaded Xcode 9.4.1. Running this version (didn't delete Xcode
10). Can run either version
Verified Swift version was set to 4.1 (4.2 was not an option)
Deleted Derived Data folder. File> Project Settings.. Clicked on
right arrow next to Derived data folder. Deleted specific project
file. Also tried deleting entire folder
Here is my long tale of woe: I have been working on a project for about 6-8 weeks, using Xcode 9.4.1 on High Sierra. I am a novice, so I created some simple "proof of concept" apps to learn about text views, attributed strings, web views, etc. Each of these small projects compiled and ran fine.
I combining these features into a single app, and adding a Cocoa Pod library. Again, everything compiled fine. I was debugging simple issues in the code. At one point, Xcode stopped showing correct values in the Variable display for my code. I was reduced to debugging with print() statements, which always showed correct variable values.
I upgraded (?) to Xcode 10, then later to Mojave to try to resolve Xcode's incorrect variable values. Other issues emerged, including known issues with evaluateJavaScript. So I decided to revert back to pre-Mojave to get back to a working state. I used Time Machine to revert back to Xcode 10 under High Sierra.
Now my projects give compile errors. Even my simple proof of concept apps have compile errors. So I've been trying to get back to compilable code.
What else should I try to determine what has changed?
Here is the specific attributed string code that is generating syntax errors:
let titleAttributes = [NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 22)]
gives error:
Type 'NSAttributedString' has no member 'Key'
I'm also getting an error on a segue:
performSegue(withIdentifier: "showSecondVC", sender: self)
gives error
Cannot convert value of type 'String' to expected argument type 'NSStoryboardSegue.Identifier'
Apologies for the long post. Under Unix, it's easy to get a user account or app back to a known initial state. It seems a lot harder under Mac OS X...
Thanks for any suggestions!
The problems you talk seem originated by Swift version.
To answer to your question, when you download a new Xcode App (and yes, you can have more than one Xcode app in the same computer) everything is inside the huge app.
All the local data are inside the folder
~/Library/Developer/Xcode/
Where you can find several folders with lot of data. If you have problems with Ide size you could check the "IDEPreferencesController.xcuserstate" that is found inside UserData folder.

Xcode autocomplete does not work in Sources folder of Swift playgrounds

I am working on a Swift playground that contains multiple files in the Sources folder alongside the main file. When I type something, for instance, "UI", in the main file, I get the expected autocomplete suggestions. However, when I do the same in files in the Sources folder, I get a "dumb" autocomplete menu as seen in this question: Xcode 9 Autocomplete Not Working 100% - Partially Working
I have tried deleting DerivedData as suggested in the above question, and have even gone to the lengths of reinstalling Xcode entirely. However, the problem has not gone away. I have created a new playground to ensure it is not specific to this project, and the same problem occurs.
Edit: I just tried the same thing on a different Mac and the same problem was observed. I suppose this is simply a bug in Xcode that has nothing to do with this particular installation or project.
In order to enable autocompletion, you can embed your Playground in a regular Xcode project (e.g. an iOS application). I recommend creating a dummy project for that purpose. Simply drag and drop your playground in this dummy project and make sure to check "Add to target".
Then you can navigate to
Target -> Build Phases -> Compile Sources -> + -> Add other
and add all the files from your source folder. Please note, that you don't need to actually copy the files, a reference is enough for this purpose.
After this process all your source files are built against this dummy target and you can use autocompletion as usual. As far as I know, this is the best practice for debugging Playgrounds right now. Anyway I am curious, if there is an easier way to achieve that.
Swift playgroundbooks do not support autocomplete. Try writing the code in a regular Swift playground, and then move the code over to the playgroundbook.
This works for me every time,
Restart/Start -> Open any existing Xcode project(use autocomplete) -> Open playground
Autocomplete will work as usual

Xcode is marking all symbols as 'undeclared type' yet they are visible and the project compiles fine

Just to get some context here is a screenshot, though you probably gathered this from the title:
Xcode is marking all symbols as undeclared, usually this would be because it doesn't exist or isn't imported, but in this case it was working fine 20 minutes ago and weirdly the project compiles and runs with no problems.
When I compile the errors go away but there is no syntax highlighting, as soon as I start to edit the file the errors all come back. I can work if I remember the exact signatures for anything that I need to use but with the lack of code completion and errors this is very hard.
Notably this is only a problem in a few source files, its not even the whole project. Nothing has changed that I am aware of that could cause this.
Before anyone suggests it, I have tried cleaning, deleting derived data/build folder, restarting Xcode etc...
My colleague is seeing the exact same issue on his machine.
So I managed to fix the offending source files, I just compared their attributes to those of a working source file and it turns out that the problem files included the tests project in their target membership and the working file did not. I'm not sure why this is causing the issue as other projects use automated testing without a problem. Nonetheless this solved it for me, at least until I start writing test cases...

XCode 7 auto-completion doesn't work properly

It seems XCode 7 (beta) doesn't get auto-completion well.
In my case it doesn't auto-complete my Parse Objects at all...
PFQuery(className:"User").getObje // Doesn't propose any completion, compilation works well
Someone solved it ?
I faced this problem in xcode 7 beta 2. The solution is to specify to xcode the directory in which the framework is located. You can do so by clicking on your project, then choosing Build Settings and search for "framework search path" after that double click on the right side of the row and click the plus sign and add the path to the directory.
NOTE: DON'T choose recursive way. This will not work. just specify EXACTLY in which directory is the Parse framework that is used in your project located.