How to add custom project configurations to Xcode when using CocoaPods? - ios

I have an iOS/OS X Xcode projects, where I'm using CocoaPods, and I can't seem to figure out how to add my own project configurations (In addition to Debug and Release) without completely blowing up the build.
In the project, I have a number of targets, for apps on both platforms and its app extensions. The Xcode workspace of course also has the Pods project.
Because the project builds targets for iOS and Mac, I use CocoaPods "targets" to group their pods together. My Podfile looks something like this:
source 'https://github.com/CocoaPods/Specs.git'
target :iOS do
platform :ios, '7.1'
link_with 'iOS', 'NozbeToday', 'NozbeShare', 'NozbeWatch'
# pods...
end
target :Mac do
platform :osx, '10.9'
link_with 'Mac'
# pods...
end
Now here's where I have a problem. So far I've had only the default "Debug" and "Release" configurations in my project. I wanted to change them and add some new ones for different provisioning profile/bundle ID combination.
… and I'm stuck. I can't figure out how to do this.
First sign of the problem was a warning pod install spewed out for every target/configuration combination:
[!] CocoaPods did not set the base configuration of your project
because your project already has a custom config set. In order for
CocoaPods integration to work at all, please either set the base
configurations of the target NozbeToday to Pods/Target Support
Files/Pods-iOS/Pods-iOS.dev debug.xcconfig or include the
Pods/Target Support Files/Pods-iOS/Pods-iOS.dev debug.xcconfig in
your build configuration.
I couldn't figure out what it means and how to fix this. Either way, the project wouldn't build — in the best case scenario I would get a linker error saying that it can't find Pods-something.a…

OK, so half-way through writing this question I figured it out myself (yay rubber ducking). Here's the solution for next generations:
Essentially, you have to add an explicit dependency on the Pods target to your application scheme.
The way you do it, is: edit your application scheme, go to the Build section, and add the Pods target above your application target. You should see something like this:
And it will just work.
As for the CocoaPods warnings on pod install, you need to use the xcconfig files generated by CP for each of your Xcode configurations. The way you do it is:
find the .xcconfig files in Pods/Target Support Files
drag and drop them to "Pods" group in your Xcode project (add reference only. Don't copy to target or add to the build)
Click on the project in project navigator, and select the project itself (not one of targets). Go to Info, and under Configurations set the right .xcconfigs to each configuration and target in the "Based on Configuration file" column.
You'll also need something like this in your Podfile to let CocoaPods know which of your Xcode configurations are "debug" (unoptimized), which are "release":
project '1Nozbe', {
'iOS 1 Dev Debug' => :debug,
'iOS 2 Dev AdHoc' => :release,
'iOS 3 Release Debug' => :debug,
'iOS 4 Release AdHoc' => :release,
'iOS 5 Release AppStore' => :release,
}
Not exactly related to CocoaPods, but if you happen to have some other (sub-project) dependencies other than CP, you'll also need to do two things:
add explicit dependencies on the sub-project target (like on the screenshot above)
rename/add configurations in your sub-project so that they are the same as your main project. (Otherwise, Xcode just doesn't know which configuration to use with your sub-project)

Add this line in your config file, just like import a header file:
#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"
NOTE: it's #include, not #import

Another solution without the need to add explict dependencies to any schema nor draging and dropping stuff:
How to add custom project configurations to Xcode when using CocoaPods
Usually when you add custom configurations to your xcode project (other than Debug and Release) the thing you should do is run pod install. This will fix/remake the changes that cocoapods usually do.
How to get ride of CocoaPods did not set the base configuration of your project because... warning
On the Configurations settings under Info tab, on project level, you need to set the base configuration to use (generated when running pod install)
And dont forget to tell cocoapods what config it should use, in other words map your condfigurations with pods configurations, otherwise your compile time might dramatically increase

What fixed it for me was:
Adding the includes to the custom config files,
Adding the project config dependencies in the pod file (use the names that you see under info -> configurations and
Then re-running pod install.
Here is the include for the config file (SupportingFiles->Config->ConfigFiles)
#include "Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.release prod.xcconfig"
Links that helped me:
Great Tutorial on setting up configs with Cocoapods
Project documentation Cocoapods
UPDATED

Related

Error "No such module" when import framework in Swift file [duplicate]

I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working

Getting error "No such module" using Xcode, but the framework is there

I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working

Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set

After I execute a pod install at the base of my project, I get the following error:
CocoaPods did not set the base configuration of your project because because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target BluePlaquesLondonFramework to Pods/Target Support Files/Pods/Pods.debug.xcconfig or include the Pods/Target Support Files/Pods/Pods.debug.xcconfig in your build configuration.
This probably sounds like a silly question, but how do I set the base configuration for a target?
https://github.com/seanoshea/BluePlaquesLondon/blob/ios8/Podfile is the Podfile which is causing this issue.
http://github.com/seanoshea/BluePlaquesLondon on the iOS 8 branch is the Podfile in question if you're curious to see what the project looks like.
I had the same problem, but in Xcode 6.1.1 - what fixed it for me was to change the configuration file setting to None for the two Pods-related targets, then run pod install again.
The configuration file setting is found by selecting the project (not the target) and then the Info tab.
Don't tinker, Reset.
Step-by-step
Show Project Navigator
Select Project
Select Info
In Configurations, select each one, one at a time (Debug, ApplicationUnitTest, Release, etc.), and for each target within said configuration, set configuration to None.
Make certain that Based on Configuration File reads 0 Configurations Set or No Configurations Set for each configuration. That is the crux.
Quit Xcode
rm -rf Pods/ Podfile.lock ; pod install
Once you have allowed pod install in step 7 to do its magic, you may be able to use a custom config and change your configurations.
Go into XCode and open your project settings and under the Info tab, you will see "Configurations" where you can set a configuration file for both Debug and Release. You apparently have already set these to some custom config and CocoaPods wants/needs you to use the Pods config.
Ran into the same problem. It would build on the simulator but not on my device. None of the answers solved this for me. Here's what I did piecing some answers together:
Changed my pods file to use a specific target:
target :MyProject do
pod 'AWSCognitoSync'
pod 'Facebook-iOS-SDK'
end
Ran pod install
That gives an error:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `MyProject` to `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` or include the `Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug.xcconfig` in your build configuration.
Go Project settings and click on Info tab. There will be an error where it cannot find the Configuration file. Set it to "None" for Debug and Release.
Run pod install yet again
Clean and build. This works.
I fixed my issue after a careful reading of the error message:
[!] CocoaPods did not set the base configuration of your project
because your project already has a custom config set. In order for
CocoaPods integration to work at all, please either set the base
configurations of the target Runner to Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig or include the Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig in your build
configuration (Flutter/Release.xcconfig).
Solution
Open Xcode and change the Runner Info Base Configurations to the
related Pods-Runner.profile.xconfig.
Quit Xcode
Terminal: From the ios project folder run pod deintegrate
Verify pods are removed
Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
Terminal: From the ios project folder run pod install
(from this original - BAD)
(to this GOOD settings)
Notes
I have not been able to resolve the issue using the second
suggestion of including the xconfig file inside of the
Flutter/Release.xcconfig configuration file as mentioned in the
error message.
You should also make sure that you have no pods in the root of Podfile, you should define all the pods that are used in many targets like that:
def shared_pods
pod 'ReactiveCocoa', '~> 2.5'
end
target 'app' do
shared_pods
pod 'RestKit'
end
target 'tests' do
shared_pods
pod 'OCMock'
end
You also might need to delete libPods.a and libPods-app.a from the target dependencies, perform a clean and then run pod install again.
For those coming from the Flutter world, this is a misleading error message suggesting an unnecessary action, and the correct course is to ignore the error and use the flutter cli (not pod), as discussed in https://github.com/flutter/flutter/issues/73845:
gatzsche says a better message would be:
In Flutter pod install should not called manually. To run pod install
execute the following commands flutter clean, flutter pub get and
flutter build ios.
jmagman notes:
As you point out, the error message is suggesting an action that isn't necessary. The flutter command suppresses that message from pod. You ran pod directly, which isn't a recommended workflow. We don't have any control of error messages coming from CocoaPods, and the flutter command line tool already suppresses the confusing message.
I just ran into this issue after adding some custom build configurations. I could see under:
Pods (target) > Target Support Files > Pods
that it had actually created the new xcconfig files that matched the new build configurations but for some reason I could not select these in the project target of my app.
What fixed it for me was to install and use cocoapods-deintegrate:
gem install cocoapods-deintegrate
and then run:
pod deintegrate
followed by:
pod install
In case you are using custom config you can follow the suggestion in the warning and include the Pod config in your config file
#include "Pods/Target Support Files/Pods-YYY/Pods-YYYY.develop-archive.xcconfig"
This will NOT stop the warnings but will allow you to use your private config (there is an open bug on the warning with CocoaPods project)
https://github.com/CocoaPods/CocoaPods/issues/2633
If you added a custom build configuration to your existing project, Cocoapods will complain about it.
Cocoapods will automatically create xcconfig files under the directory Pods/Target Support Files/<build_target> following the naming pattern Pods-<build_target>.<build_config>.xcconfig.
Just make sure to manually add those files to your project in Xcode (under the Pods directory, but not inside the Pods project!). Once those files are included select your project in Xcode, go to the "Info" tab, and expand your custom configuration. Select the appropriate xcconfig file for each target under your custom configuration.
The line in the podfile that is generating a problem is : link_with ['BluePlaquesLondon', 'BluePlaquesLondonFramework'].
Just make this : link_with ['BluePlaquesLondon'] or this (worked in my case, hope it will in yours :-)) :
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
xcodeproj 'BluePlaquesLondon.xcodeproj'
inhibit_all_warnings!
link_with ['BluePlaquesLondon']
def import_pods
pod 'TTTAttributedLabel', '~> 1.10.1'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.0.9'
pod 'Google-Maps-iOS-SDK'
pod 'IntentKit'
pod 'HCViews'
pod 'SVProgressHUD', :head
pod 'iRate'
pod 'iOS-KML-Framework', :git => 'https://github.com/FLCLjp/iOS-KML-Framework.git'
end
import_pods
target "BluePlaquesLondonFramework" do
import_pods
pod 'Kiwi'
end
I had the same error while pod install. I tried everything (reinstall pod, update all gems, etc.) and I found solution worked in my case. There was problem because of changing target's name. In this case solution is simple:
Click Product -> Scheme -> Manage Schemes...
Click on your target on the list and delete it with "-" sign on bottom of window.
Click "+" to add target back to list. Choose correct target and name.
After all everything should works.
I moved pods in Podfile outside from the target. File changes from this:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'MyProject' do
pod 'Firebase', '>= 2.5.0'
pod 'Onboard'
pod 'GoogleMaps'
pod 'IQDropDownTextField'
end
To this:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Firebase', '>= 2.5.0'
pod 'Onboard'
pod 'GoogleMaps'
pod 'IQDropDownTextField'
target 'MyProject' do
end
Add the relevent xcconfig files to your project. Cocoapods will have created them but you can't set them in Xcode until they are in the project.
You probably want to add them to the Pods group where the other pods xcconfig files are. Right click and add files.
Search for xcconfig files in your project folder or look in Pods/Target Support Files/[TARGET_NAME]/ (I have different cocoapods configured for each target (extension and main project this may be slightly different in your case)
Go to project configurations in the Info of your main project
For each target and configuration set the appropriate pods configuration.
pod install again and you should see no errors.
So for me, the problem was due to the aforementioned xcconfig files names being changed before the Swift 3 update took place.
Something was out of sync, so Cocoapods created a 'Recovered References' folder section with the old named files, and linked to them.
To fix this, I:
Removed the 'Recovered References' folder and the containing old
.xcconfig files from Xcode and file system
Quit Xcode
Run pod install
Everything was handled for me after then, and the warnings were gone.
I was able to build the project touched by this issue on XCode 6 by:
selecting Project from the Project Navigator
choosing Project instead of Target
going to Info tab
choosing Pods.(debug/release) Configuration Files from the combobox for the respective Configurations.
Hope this will help someone.
This happened to me because I already had a Pod configuration. I'm new on iOS development, was searching instructions to install Alamofire + SwiftyJSON and ended up installing the libraries more than once, inadvertently. To me, what worked was: on the folder "Target Support Files" in "Pods" project, I selected the two correct .xcconfig files and dragged them to the "Pods" folder of my app project. This enabled the selection of the correct config files on the base configuration.
But then, if I run "pod install" again, the warning will change to the previous .xcconfig file. I try to delete the files and the old framework from the main project but when i ran the previous command once more, gave me the same warning, and created the file "Pods.framework" under the "Pods" folder of my app project. I ignored it, and it seems to be running ok, despite the two frameworks. I don't know if it's right, and a solution, if exists, it would be welcomed.
I had error:
diff: /../Podfile.lock: No such file or directory diff: /Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock.
I just checked the path where I was installing the pod and corrected it and installed again,It just worked.
Make sure give the path just before where .xcodeproj or .xcworkspace (if it is already there) exists.
Sorry my previous answer was unclear. This was just one of many errors i've got while trying to set up Cloud Firestore, so this answer is specific for that situation. In order to solve this error and make firebase work, eventually, you have to follow all of the steps from this page: https://firebase.flutter.dev/docs/firestore/overview/ . If you are having problems with generating the 'firebase_options.dart' file, then you need to follow the steps on this page: https://firebase.google.com/docs/cli#mac-linux-auto-script . The last step is optional, but it reduces build time, and I really don't know how or why, but it made some of other errors also disappear... Step 4. Improve iOS & macOS build times, from this page https://firebase.flutter.dev/docs/firestore/overview/. And off course, don't forget to add dependencies in pubspec.yaml: https://pub.dev/packages/firebase_core/install . There is also a great comment here about using Firebase.initializeApp() : https://stackoverflow.com/a/63492262/17626190
Seems a good ole system restart and probably more importantly it seems I had to reinstall cocoa pods even though the CLI seemed to be in perfectly working condition and had been working for many days before today.
Reinstalled CocoaPods 🤷
sudo gem install cocoapods
It doesn't seem this was the fix for anyone else, but I figured I should post it since this was driving me nuts, and hopefully it helps at least one other person.
This is the messages I got after running pod install or pod update:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig` in your build configuration (`Flutter/Debug.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
This is what I did to solve the issue:
Add Schemes to Podfile under project 'Runner'
project 'Runner', {
'Debug' => :debug,
'Debug-staging' => :debug,
'Profile' => :release,
'Profile-staging' => :release,
'Release' => :release,
'Release-staging' => :release,
}
Go to ios/Flutter/Debug.xcconfig and include
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig"
Go to ios/Flutter/Release.xcconfig and include
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release-staging.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile-staging.xcconfig"
flutter clean
Delete podfile.lock
Pub get
pod install
Just follow the Android Studio instructions.
This is the error output:
"[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`)."
In android studio IDE go to IOS folder/Flutter and open the file Release.xconfig
Then just past this line:
Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig
Delete podfile.lock and try to rebuild in Xcode. Worked for me.
The simplest solution for this (after having this issue multiple times):
Delete Podfile & Podfile.lock from your project library (save Podfile somewhere so you could easily paste to new Podfile)
run 'pod init'
Edit the 'Podfile' to your will (add pods you are using)
run 'pod install'
This would recreate everything and works always in minutes (not spending time to reverse engineer the "bug").

Do not Integrate TestFlight SDK in Release Builds using Cocoapods

I integrated the TestFlight SDK using Cocoapods with the following Podfile: https://gist.github.com/fabb/8841271
I do not want the TestFlight library to be linked in Release builds (build config, not target).
This article shows a way to remove the libTestFlight.a file from Release builds using the EXCLUDED_SOURCE_FILE_NAMES custom build setting.
Is there a way I can do this using Cocoapods too? Remember, Cocoapods does link the libTestFlight.a into its libPods.a, so setting the custom build setting in the app target will not help.
An alternative idea would be to only include the TestFlight SDK pod for my TestFlightRelease build config - but it seems this is not yet supported by Cocoapods.
There is a suggested workaround while the feature gets implemented:
Create a new (empty) target of type "Static Library" named
"DebugTools" in your user project
Link it with your application, but
only in Debug, by adding -lDebugTools to the OTHER_LDFLAGS Build
Setting but only for the Debug configuration (don't forget to keep
$(inherited) if not present already)
Then you should be able to
configure the pods needed in debug by adding them in the DebugTool
target only, via your Podfile, like:
pod 'AFNetworking' # For all build configurations, Debug and Release
target 'DebugTools', :exclusive => true do
pod 'PonyDebugger' # Debugger only needed in debug
pod 'OHHTTPStubs' # Stubs for Network Requests only in debug too
end
The implementation status is updated in the same thread.

cocoapods pods project build settings

So everytime we run a pod update, the pods project gets regenerated. Whatever build settings we manually set in the pods project is reset.
I'm wondering if theres anyway to set some build settings of the targets in the pods project after the pod project is generated by a pod update?
Any help is appreciated.
After a few hours of twiddling with cocoapods and reading documentation, I have come up with the following solution:
In your podspec file, there is an option to specify the xcconfig to be generated, set the following:
s.xcconfig = {'TEST_AFTER_BUILD' => 'YES', 'GCC_GENERATE_TEST_COVERAGE_FILES' => 'YES'}
In my case i needed to generate coverage files from the pods project.
This will in turn be generated in the xcconfig file after the pod update and hence be included in the pods project.
Pod is design to automatically set those build settings so that you don't have to,
If you are talking about the build setting in your own project, normally cocoaPods will not touch those settings.

Resources