Xcode: How to remove a target dependency from the build phase for a specific configuration - ios

I have an app that includes a Watch Extension and App target. I would to be able to have one of my configurations (for a beta) exclude these targets from the target dependencies so that I can distribute the build without the Watch Extension/App. However I still want my debug configuration to include them. Is this possible? Perhaps there is some run script that could add Target Dependencies manually? Thanks.

Duplicate your "Release" Configuration, that will include your Watch Extension. Here the official resource: https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/BasingBuildConfigurationsonConfigurationFiles.html
In this configuration.
Remove the WatchKit extension from Target Dependencies
Remove WatchKit extension from Embed App Extensions

Duplicate your main target and remove the dependencies from the copy. Then duplicate your scheme and set its target to your new target.
Another solution would be to wrap the build and embedding into a separate script and run it manually, you can see how cocoapods are doing that.

Related

Build Libraries for Distribution” into ”Yes” Swift

In my project I have enabled the Build Libraries for Distribution” into ”Yes” into my SDK build setting, to prevent swift upgrades from causing a problem for third party libraries. In this case, When I Build with the project for SDK, I have set legacy mode but I am facing issue like below:


The legacy does not support Build Libraries for Distribution” into ”Yes”.
How to fix this? I can able to build the project new build system instead of legacy mode
The reason for setting legacy mode is When I set a new build system and prepare to build I am getting this below error. To fix this I am using legacy mode
Multiple commands produce '/Path/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-54e75ca4' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
The workaround for this build system issue is to explicitly add all the needed GoogleUtilities subspecs to the Podfile. See the Podfile.lock file to get the list. Full details at https://github.com/firebase/firebase-ios-sdk/issues/4087

Xcode: Custom build configurations in Swift Package Manager

I'm trying to get SPM to work with different build configurations other than Debug and Release. Our iOS project has different schemes (e.g. Debug-Staging, Debug-Production, Alpha-Staging, Alpha-Production, etc.) where I set the bundle identifier, some flags, etc.
Is there a way to achieve that diversification even if SPM only "understands" Debug and Release?
Specify path to your custom config file when invoking generate-xcodeproj command.
Sample
swift-package generate-xcodeproj --xcconfig-overrides Config.xcconfig

Accessing xcode variables in Cordova config

I have an iOS application that has many different configurations all under the same Xcode project. I am using Targets to achieve this. My application utilizes Cordova. I am wondering if it is possible/best way to access Xcode variables within my Cordova config.xml file.
I am hoping to achieve having one shared config file with many targets in Xcode and when I select a target and build and run my variables for that target will be dynamically injected into my config.
Try to create 'Configuration Settings File' (.xcconfig) and configure variables from the info.plist with this pattern $(VARIABLE) and add into the .xcconfig file. This way you'll be able to set “Bundle Identifier”, “Bundle name”, “Bundle version” and other stuff you need to configure.
You may refer guide link to get more info: https://www.appcoda.com/xcconfig-guide/
Hope it helps!

Specify individual target build settings with xcodebuild

I have an iOS app that uses Cocoapods, and has a local cocoa touch framework target, and I'm running into an issue with specifying build settings in the command line using xcodebuild.
I understand that you can specify build settings like PROVISIONING_PROFILE, CODE_SIGN_IDENTITY, and DEVELOPMENT_TEAM by appending their key=value pair to the end of the command.
However those setting appear to be applied to the entire project, but I only need them to apply to the app target since touch frameworks cannot be signed.
How do I specify build settings for an individual target using xcodebuild? If it cannot be done using xcodebuild, could this be accomplished using fastlane?
Use schemes. You can set the scheme to build/archive with a particular build configuration and executable.

Embedded framework build directory not matching scheme

I have several frameworks embedded in my Xcode workspace. In my scheme list, I have four schemes - 2 products: 1 release, 1 beta version of each. Each scheme has its own info.plist, product name, build settings, build path. In my main scheme, my app will build and archive correctly.
When I change to the alternate scheme (release or beta) I get a build error because my embedded frameworks are building in the original build/Release-iphoneos directory and not the build/Release AlternateName-iphoneos. I have tried everything I can think of to get my Framework SearchPaths and Library SearchPaths to point to the embedded framework build directory but I'm having no luck.
Has anyone run into this problem before or have any suggestions? Would the best solution be to have a run script phase that copies the embedded builds into the target directory?

Resources