Where Xcode 8 places build logs? - xcode

So, the question describes itself.
I want to edit the log after each build to cut out swift 3 ugly warnings like Result of call to '...' is unused

In Xcode > Preferences > Locations you can define (or automatically accept the default path ~/Library/Developer/Xcode/DerivedData/) the location of the 'DerivedData' folder which is where the build logs are stored.
Go there and tap the -> arrow to see the folder organization. Apple introduces unique folder name extensions which would have to be determined and built into any script that would analyze or process the log.

You could always go to your target settings and set the "Inhibit All Warnings" checkbox to ON.
As for editing the transcript directly, I suspect this is something you can't easily do, as build transcripts can be exported (hold down the control key while clicking on a build log in the Report Navigator in the left side of the Xcode project window) and I think they must be stored in some Apple System Log-like binary format.

Related

How to prevent (and recover from) Xcode 12 NoBuildableEntriesError errors?

Sometimes when I reopen an existing Swift UI project in Xcode 12, the component preview pane fails to display previews of components and displays the following error message instead:
NoBuildableEntriesError: active scheme does not build this file
Select a scheme that builds a target which contains the current file,
or add this file to a target that is built by the current scheme.
How can I resolve this and prevent it from happening again?
In particular, how can I:
"select a scheme that builds a target which contains the current file", and/or
"add this file to a target that is built by the current scheme."
Below is the Scheme it is at the very top of Xcode you can click it to change it.
And the membership is in the file inspector. Just click the Target you want.
My CustomPicker.swift files does NOT belong to StackOverflow14-Multi (macOS)

Debugging Quicklook Plugin in Xcode

I am trying to debug a quicklook plugin in Xcode 4.6. I have created the executable in Edit Scheme.
Now, when I build the project the plugin is not installed to the "/Library/Quicklook" path.
Rather I didn't find it anywhere.
I want to run the plugin in debug mode and want to hit the breakpoints so that I can figure out where the plugin crashes on different files.
You can use brake points and NSLog function for debugging QL plugin. But first you need to configure environment.
Select your project on Project Navigator
Then select QL plugin target
Go to 'Build Phases' tab and add new phase 'Copy files'
Select 'Absolute Path' on destination drop down menu and set ~/Library/QuickLook as subpath
Open terminal and copy qlmanage to your project's root directory with command cp /usr/bin/qlmanage PROJECT_ROOT_DIR
Then select menu Product -> Scheme -> Edit Scheme...
Select 'Run' on schemes list
On info tab select executable drop down menu, then 'Other...' and select qlmanage binary you have copied to project's root directory
On arguments tab add row for 'Arguments Passed On Launch' and set value to -p FULL_PATH_TO_FILE_FOR_PREVIEW
After all steps you can run your project and debug your code.
Xcode 6 must be different somehow, because the instructions above didn't work for me. But here's a solution that I puzzled out today and that works. Hopefuly it will help someone else.
(Assume the name of your plugin is myplugin.qlgenerator)
First of all, if you tried the earlier solutions above, undo them.
Delete the Copy Phase that copies your binary to ~/Library/Quicklook and delete the copy of qlmanage you may have copied to your project's root.
Set the Executable to /usr/bin/qlmanage. "qlmanage" is the program that will load and run your plugin.
Edit your scheme.
Choose 'Run' from the list on the left, then the Info tab of the display on the right.
Choose 'Other...' from the Executable popup. A standard file sheet will appear.
Type cmd-shift-g. A 'Go to folder' sheet appears with a text field.
Enter /usr/bin/ and hit the Go button. The standard file sheet should now be showing the contents of /usr/bin.
Select the 'qlmanage' binary
Turn on the 'Debug executable' checkbox and click the Choose button.
Configure the Arguments Xcode passes to qlmanage
Select the Arguments tab in the Run section of the Edit Schemes sheet.
Remove any arguments that may be left over from previous attempts.
Add -c public.data as the first argument to be passed on launch. You may need to change this depending on the kind of UTIs your plugin supports.
Add -g $(BUILD_DIR)/Debug/myplugin.qlgenerator as the second argument. This resolves to a path to the debug version of your plugin.
Add -p '/fullpath/to/file/to/be/quicklooked as the third argument. This is a path to a file that should already exist. Your plugin will be asked to render previews of this file.
Close the Schemes sheet.
That's it. You should now be able to debug your pluging including setting (and hitting) breakpoints!
I've written this blog post describing how to debug Quick Look plugins which should work as of Xcode 8.2 / macOS 10.12.
Giving due credit, this is basically the steps given here by mlist0987 but with an extra step to get around the System Integrity Protection introduced in 10.11.
TLDR: you have to take a copy of the version of qlmanage, referenced by the link in /usr/bin (i.e. don't just copy the alias) and set that as the debugging executable.

How delete the config in Build Settings in a low level in XCode 4

In XCode 4.0.2 there is a good way to configure the program in Build Settings when you click in "Levels" format. Like this screen
The levels are in this way:
Target Settings
Project Settings
iOS Default Settings
So the XCode see if the Target have a config, if not see in project and if not use the iOS default.
The problem here is that when you set a config in a low level and than delete it, it's impossible use the config of a upper level.
Like in image. I set all targets to use Google in Current Project Version, but in this target I want it use stackOverflow and it work. But in the other Generated Versioning ... I first config with stackOverflow but change my mind and want to use the Project Settings. Now is impossible delete the Target Settings and I will have to enter it manually.
How can I delete the target setting to use the project setting?
In xcode 5 it worked right simple for me. I had the same situation as in the picture in the question. Some data in the project setting and an empty but green setting on target level.
You have to select the line e.g. with the mouse that is marked and afterwards press the delete button the green marking is gone from the target level. In my test it and it will never delete the setting on the highes level, so there is no risk.
Click the Combined button and change the build setting value. Now when you click the Levels button, you will see the target and project both have the new value for the build setting.
I just figured this out. It's a little sketchy, but it works, and does not feel dangerous to me (particularly if you're using version control).
In Xcode, delete the text from the target-level configuration. Make sure you still have it defined at the project level.
Look at a diff of the YourProjectName.xcodeproj/project.pbxproj so you can figure out the code-level name of the setting you just changed. For example, in Xcode, I deleted the text from my target-level configuration for "Other C Flags". My diff showed the OTHER_CFLAGS setting changing from OTHER_CFLAGS="mytargetlevelsetting" to OTHER_CFLAGS="". If you're using version control (which you should be), it'll be easy to get this diff.
Quit Xcode.
Open up YourProjectName.xcodeproj/project.pbxproj in a text editor. Find all the lines starting with the setting name you found in step 2. Delete all the ones where the value is an empty string, and keep all the rest. For example, I deleted all the lines that said OTHER_CFLAGS="", but kept all the lines that said OTHER_CFLAGS="settingiwanttokeep". If you don't see any where the value is an empty string, or all their values are empty strings, you probably didn't follow step 1.
When you reopen Xcode and look at your target's build settings again, the setting in question should be using the project-level configuration, not the target.

xcode 4 list of files with target

In Xcode 3 it was easy to get an overview of which files are activated for current active target. I love the new feature in Xcode 4 where you can see all the targets a specific file is active for (its like an inversed view of xcode 3). Is there some mysterious way of getting that good ol' view back?
It would be really handy when specifying test-files and nibs for different targets...
Image from that good ol' list in xcode 3:
Expanding on tomwhipple's answer, there is a way to see all the files that are not part of a target.
Go to -> Build Phases -> Compile Sources and hit the '+' button. This will show you all the files that are not part of the target. However, this list is pretty cluttered with things that really shouldn't be in your target. But you can type ".m" in the search bar to only show the classes that aren't included.
By Target: Navigate to the project, then select the target and expand the various build phases. It's more specific because it shows you what role the file(s) play in the target.
By file: Select the file in the navigator and open the Utility pane. The targets list is shown there (but only for that one file).
I also find this lack of a checkmark list annoying. I did notice that you can add multiple files to a target via the + icon at the bottom of the compile sources list in the "by target" method.

How to also change the location of index files when changing the default build location in Xcode?

I'm using Xcode version 3.2.2.
If I follow these steps with Xcode:
create a new Cocoa application called "Test"
in Info change the "Build Products Path" to "_build"
build project
I find that there is still a "build" directory being created called:
build/Test.build/Test.pbxindex/<various files>
These look like the files that Xcode creates when indexing the project. Is there anyway to change this location so these go into the new "_build" location?
I've just tested the steps you outlined above in XCode 3.2.3 and I could not reproduce that symptom. Renaming the build products path to "_build" properly moves all build-related files (and the .pbindex) to that location. I have also built with the different XCode-project compatibility options with the same results.
Thinking this might be a bug in XCode 3.2.2, I've read the changelog but no such symptom is reported, and I personally have not seen that before.
An option that might help (but it should NOT be necessary) is to set the Build Intermediate Files path (in the Info panel of the Project) to the "Build products location", but I presume you have already tried that. In my XCode, the only case where the .pbxindex files do get built in another location is when I force them to by choosing the "Custom location" in the same panel.
Is it possible that it's a simple oversight on your part and that you haven't removed the directory after the cleanup? If not, then some more information would be helpful:
perform a clean build
open up the debugger (CMD+Shift+B)
from the toolbar, make sure you have toggled "All Results" under overview, "By Step", and "All Messages" from the last combobox
right-click somewhere in the debug output, and choose the option "Open These Results as a Transcript File"
HTH

Resources