How to specify configuration for framework in Xcode? - ios

I cannot understand how to specify configuration for framework
For example, I have the project "MyProject.xcodeproj" with 3 configurations: Debug, Stage and Production. The project includes my framework "Xelby" so when I trying to build the project Xcode fails with error "Xelby framework not found".
Xelby has 2 configurations Release and Debug. So I don't understand how to specify Release configuration of Xelby on Stage configuration in my project.
I tried to add Release folder to Framework Search Paths but Xcode began to behave inappropriately, constantly hung up and other

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 SwiftGen: build fails in project with multiple targets

How should I configure SwiftGen when using Cocoapods and multiple targets?
I have a project with two targets (MyProject and MyProject Dev) which has SwiftGen integrated with Cocoapods.
I can build the first target with no problems whatsoever. However the 'Dev' target always fails. The script phase is the last step in Build Phases, however running it earlier or later seems to make no difference.
On failure, I've observed the following:
The generated .swift file has an import statement, 'import MyProject' which shouldn't be there
'No type named [ClassName] in module [MyProject]' OR 'No such module [MyProject]'
SwiftGen version I'm using is 5.2.1
Xcode 9.2, targeting iOS 10.0
SwiftGen from version 5 onwards requires a configuration file, so I've set one up as follows:
output_paths: Sources/Generated
storyboards:
- paths: MyProject/Storyboards/Base.lproj
templateName: swift4
output: MyProject/Storyboards/Storyboards.swift
params:
ignoreTargetModule: true
So far I've looked up documentation and the following issue:
https://github.com/SwiftGen/SwiftGen/issues/273
However the difference is that I'm using a different type of SG installation and my project fails to build (rather than simply not generating any resources)
Cleaning project, build folder and deleting derived data had no effect. I'm assuming that I may have missed something in configuration setup, but I can't see what that would be.
First question on here, so apologies if I missed something, will be happy to edit.
I had the same issue with generating Storyboard file. Try to modify your config file:
params:
ignoreTargetModule: true
module: <YOUR_PROJECT_NAME>
Hope it will help.
Hesitant to call this a solution, it's more of a workaround, but the following approach has at least allowed the projects to be built and run.
Remove the SwiftGen script phase from the 'Dev' target
Build the project using the main scheme that includes SwiftGen to generate all the necessary objects and constructs
Switch to Dev scheme and run the project.
The Strings.swift file created by SwiftGen is linked to both targets, so even after running the script in one scheme the resources within that file will be available to both regular and Dev targets.
Hope this helps someone.

iOS - Custom Configuration - "No such module"

In my ios app, I'm trying to distinguish environments, to make web api calls to the proper environment (Development, Staging and Production).
For that I have created a configuration.plist file with the different endpoints for each environment and:
Duplicated the Debug Configuration and called it Development Build.
Created a new Scheme called Development (duplicated the Debug scheme)
and in the Info tab (Run section) chose the Development Build
configuration.
When I run in Debug mode, everything runs normally.
I'm using cocoa pods.
If I select Development scheme, I get a No such module 'JazzHands'
If I edit the Development scheme to use the Debug build, it works fine.
So I must be missing some thing for this not to work.
For those running into this question, try pod install this will generate some .xcconfig files with your configuration name. Clean your build folder and build again.
This worked for me with Cocoapods 1.0
Solution:
Create the same custom build configuration in JazzHands
Root cause:
Compilation error No such module is thrown because it can't locate the JazzHands for your custom build configuration
Background:
Every time you compile a folder is created in DerivedData.
This folder corresponds to your device / simulator and your app.
Inside this folder there would be a Build folder which would contain a folder corresponding to each build configuration for your project.
In your case Development folder would not contain the framework JazzHands binary
However Debug folder would contain the framework JazzHands binary
Example:
Given below is an example:
~/Library/Developer/Xcode/DerivedData/SomeApp-skjahjkdhsakjhdaskjdhaskjlhs/Build/Development-iphonesimulator
SomeApp - Name of the app
Development - Custom Build configuration

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?

Xcode commandline building with dependent project

I'm building a iOS application that uses a library that I've built using jverkoey's framework structure. All is well and good, until I try to let my CI environment (Jenkins) build my project. Jenkins builds using the commandline and when it does so my dependent framework gets built in it's own build directory, and when my main application builds in it's own directory it can't find the framework.
As a test I copied the output from my dependent frameworks build directory into the main apps build directory and re-ran my commandline build and everything works fine. So what I think I have to do is update my Jenkins build scripts to be able to move the dependent build output before building the main app, or change them to all build in the same directory as XCode does from the IDE with it's DerivedData directory.
The question is, how? I'm no expert when it comes to building from the commandline and I could really use some help here.
Ok, I figured this out. Just incase anyone else has a similar problem you can set the SYMROOT setting to whatever directory you want when running xcodebuild.
xcodebuild -target MyTarget SYMROOT=/Build/MyProj/Sym.root

Resources