If I create a new project in Xcode 7.3 the "Preprocessor Macros" setting only appears for the project. It doesn't appear in the build settings for any of the targets in my project.
How do you create a preprocessor macro for a target only in a project in Xcode 7.3?
When you use the default view in Xcode (Basic), you only see a list of settings that are changed. When you create a new scheme, you have few (or no, can't remember) changed settings, and consequently wouldn't see the Preprocessor Macros region. Change your view to Advanced, and everything should become visible.
I think you can alternatively search the name directly, and that should pull it up too. I can't remember offhand, though, and I'm not at my Mac at the moment.
Related
[!] The `SampleUITests [Prod]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`
build setting defined in `Pods/Target Support Files/Pods-Sample-SampleUITests/Pods-Sample-SampleUITests.prod.xcconfig'.
This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I am getting the above warning when i try to create a new xcode project and add cocoa pods into the project. I already tried the solutions mentioned in What's ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES with CocoaPods, Swift 3 and Xcode 8 but nothing worked for me.
In some Xcode versions(in my case 12.2), when we create a new project with tests included, Xcode sets the "Always Embed Swift Standard Libraries" for tests and UITests to Yes and it would be shown in Bold text, which indicates its overridden
To confirm this,
check in your project's build settings and target's build settings if the "Always Embed Swift Standard Libraries" setting has been modified by Xcode.
Typically it should appear like this in Normal text (not bold) meaning its not modified.
Non modified build setting
Certain versions of Xcode modifies this setting and hence it would appear in Bold text
modified build setting
To resolve this,
Go to the project's Pbxproj file (open in VSCode or any editor)
Search and remove all mentions
of ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
On doing so, the project
would take default settings for
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES.
Try pod install/pod update now and the build setting warning should no longer occur.
When I switch to build any target that is not the first target. The code editor does not recognize the target change.
So any code
#if <other target>
...
#endif
...is not recognized by appCode editor. When building, works as expected isolating code build for each target.
Setup: Target Configuration 'Other Swift Flags'
-D<other target>
In Xcode changing the build target changes what code the editor recognizes. Is there some other place to change this that I can't find? Is this a bug or a limitation?
This functionality is not implemented yet - please, watch this issue for further updates.
I am working with multiple targets in Xcode 8.2, Everything is good except handling files.
To import files, I have used different pch for each target but facing issues in using different class files.
How to work with other target files in the source, it throws an error on build app. When I try to add Preprocessor Macros in Build Settings but I can't find the Preprocessor Macros section in Xcode 8. Is there any alternative to this? please suggest some other approaches to handle different target files in the same source.
Thanks in Advance.
Select the target and go to build setting.
There search for "Preprocessor Macros" you will be able to find out.
Set the macros for particular target.
Use #ifdef in the code to check whether macros is defined or not, based on macros definition write the code for specific target.
That particular code will be reflected to that target only.
Is there a way to change the build version in Xcode 8?
I see the option below, but it won't seem to change it for me. It's stuck on "1.0.10" (what I last had it as before the new Xcode release).
You can set the value via a xcconfig file. Create a Configuration Settings File in Xcode with the following content
CURRENT_PROJECT_VERSION = 1.10.11
Then add this file in Project Settings | Configurations to the project or the desired targets.
EDIT: Btw. you can see where this value is currently set when you select Levels instead of Combined in the table header of the build settings.
I have a project that contains an App, a custom keyboard and an embedded framework. A bit of context...
The app was created as an ObjC project a while ago, the keyboard was also started as ObjC. The embedded framework was added later as ObjC as well.
The project is being converted to Swift. I can see the Swift compiler options in the project but setting a value at the project level trickles down into User-Defined settings at the target level.
Here's a screenshot of what I'm trying to explain.
On the left is the project-level settings, on the right are the target-level settings.
Please note that creating a new project with the same setup does show the Swift compiler settings.
How can I make these settings show up? What are the impacts of having these settings in User-Defined? Are they going to act the same way?