iOS - Custom Configuration - "No such module" - ios

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

Related

How to configure independent .xcconfig for every Configuration(Debug, Release) in each target on a project with CocoaPods added

I have a project which supports multiple Brands (used targets to configure appicon, Launch Screen .., etc) and each targets needs multiple environments where am using Configuration(Debug, Release) with schemes for every configuration.
Now to add environment variables am using .xcconfig files which am not sure how to configure for every target. The Configuration on Project level in Xcode has Cocoapods configured.
NOTE: While pod install, it shows warning in terminal to include pods config data into my custom config file. Any easy way to achieve this ?
Found a helpful link where it explains about import config into a config.
https://betterprogramming.pub/working-with-custom-xcconfigs-and-coccoapods-6b87ead94708

Xcode build issue after creating two different schemes of development and production

I created two schemes with configurations one for development and one for production. And i just moved the info.plist file to another folder called configs.
Now when I try to build I get this build error.
Multiple commands produce '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist':
Target 'Etadweer' (project 'Etadweer') has copy command from '/Users/keghamkarsian/Documents/APPS/Etadweer/Etadweer/Configs/Info.plist' to '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist'
Target 'Etadweer' (project 'Etadweer') has process command with output '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist'
I tried reinstalling the pods, updating the Cocoapods, I tried deleting the info.plist file from the build phases copy bundle resources it displays another error that it could't locate the plist file. So I have to add it to the target again.
What should I do now?

How to specify configuration for framework in Xcode?

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

There are missing files when I archived from custom build configuration

We have different build configurations in our project, like the release, debug, sandbox, etc. The interesting case is when I archived from the release or debug build configuration, all archive files extracted as expected as shown in Image 1, but If I change build configuration to sandbox, some files and folders are missing as shown in Image 2.
Although we created custom build configurations by duplicating from debug or release, the archive doesn't contain all files or folders like in Image 1.
We use carthage(for internal network) and cocoapods(for others) as a dependency manager.
I tried many suggestions but couldn't find a solution.
Like,
setting skip install to NO in build settings,
removing all archive and derived data files, clean and re-archive,
giving the archive folder to read & write permission
Thank you all
If you're using Carthage for internal frameworks you should have same custom build configurations for them, too. Otherwise, it will bootstrap with Release configuration automatically which won't generate SwiftSupport files etc.
You also can avoid this by adding below before archiving in your custom configurations.
carthage bootstrap --configuration Debug
You should make sure that those files are included in Build Phases -> Copy Bundle Resources

Archiving xcode project that contains static library

I created a project with static library.
When I tried to archive, It fails and library Headers are missing.
But when I build the app, it works fine.
And in build folder headers, bundle resources and library are created outside app file.
Is it possible to create these file in app file and archive
or any other process available for archiving?
Thanks in advance.
If you are able to build the app but not archive then it seems that the build settings that you are using for archive build configuration (probably Release) is not correct. Quick test will be to change the build configuration for archive to same as build, most probably Debug (you can do that in Product->Scheme->Edit Scheme).
To fix this you can open the Build Settings for your target, search for "Header Search Path", click the ">" to open this setting and fix it for the build configuration that is used by archive (i.e. make it same as the build configuration used by Build)

Resources