precompiled header name gets stuck - xcode

I'm new to xcode and I must be missing something.
Create a new command-line project. Call it tempprog (for instance).
Select Project/Edit Project Settings.
Edit the name of the prefix header (tempprog_Prefixz.pch).
Build - it will fail, of course, looking for tempprog_Prefixz.pch
Now change the name of the prefix header back to tempprog_Prefix.pch.
Build again - it should work, but doesn't. It's still looking for tempprog_Prefixz.pch
Cleaning does not rectify the situation. What am I missing here? Where is the Prefixz.pch name being retained? If you look in the build output at the ProcessPCH command you can see that it still wants to use Prefixz.

It turns out there's a system of setting priorities.
From Working With Xcode Build Settings:
The levels at which build settings can be set, and their precedences are:
xcodebuild command-line flags (only applicable for command-line builds)
The target, editable via a target's Info inspector
The project, editable via a project's Info inspector
Xcode application settings, as set in Xcode > Preferences...
Xcode's built in defaults
The user environment, perhaps as set in a user's ~/.MacOSX/environment.plist file

Restarting your mac fixes the problem.

Related

Where Xcode 8 places build logs?

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.

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.

What option in XCode needs to be changed

ALL,
I'm working with XCode 4.2 on Snow Leopard to build a custom application. It is not intended to be put on the Apple Store.
The question I have is: what option I need to change in order to place the resulting bundle in my home directory and not to the XCode default place?
Thank you.
Go to Xcode > Preferences > Locations.
There you can change the path of the derived data. You can change the location of all your projects' derived data or use the Advanced option to be able to set the location for your targets separately using target settings.

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 can't find Info.plist or Prefix.pch when making a Release build

I have a project that shares some files between a Mac application and an iPad app. Because of this, I moved the Info.plist and Prefix.pch files for each one into sub folders for Mac and iPad, respectively. I can build the iPad app in Debug configuration without issue, for the simulator and for a device. I get the following messages in the build results:
Process iPad/Fogozine-Info.plist
Precompile iPad/Fogozine_Prefix.pch
with a big green check mark next to both. Everything is fine.
When I build for Release, though, I get the following:
Process Fogozine-Info.plist
The file "Fogozine-Info.plist" couldn't be opened because there is no such file.
Precompile Fogozine_Prefix.pch
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
with big red exclamation marks next to them. Is there some build setting I'm missing that's specific to the release build? I can see there's an Info.plist entry in the Build settings, but the end result is the same regardless of if I leave it empty, set it to iPad, or set it to iPad/Fogozine-Info.plist, for all build configurations. I don't see anything related to the Prefix.pch file. This seems like a bug in Xcode. Any help would be greatly appreciated.
I got it. I was looking in the Project's build settings, but I needed to look in the Target's build settings. The two settings I needed to modify were Info.plist File and Prefix Header. When I modified them initially, I must have only modified them for the Debug Build Configuration.

Resources