You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on May 20, 2025. It is now read-only.
[iOS] Third-party libraries not found for "staging" config: Solution! #426
I installed CodePush in my app today and followed the instructions for multi-environments, where the docs say to create a "staging" project configuration. After doing that, the project would not build at all when the scheme was set to "staging", complaining that no libraries could be found. Re-linking with rnpm didn't help, but I figured out that the issue was that no third-party libraries (including code-push!) include the staging configuration, making the build fail.
I had to change it a bit, using the same string for "header search paths" as "framework search paths" (functionally omitting the /include part of that string), but now everything works.
I think this should be mentioned in the documentation right where the user is instructed to create the "staging" configuration.
Daniel Dunderfelt (@danieldunderfelt) Unfortunately I was unable to repro the error you were seeing.
After duplicating the release config and calling it staging + setting up the CODEPUSH_KEY config, all I did was go to Product > Scheme > Edit Scheme then set the Build Configuration to Staging. After that I ran the app and it was sync-ing against CodePush with the Staging key just fine.
What version of XCode are you on? I don't know if that matters but I'm using v7.1.1.
Also are you using CocoaPods for dependency management?
When I figured out why my builds weren't working, that the third-party packages didn't have a staging config, I thought having cocoapods wouldn't matter.
Nice, this did also fix it for me. I omitted the Step 3 (changing the project.pbxproj) and my Fabric.framework does still work fine.
However when I use different PRODUCT_NAMES for the different build environment, I am getting now a build error. I am have setup the names according to this article
When i build my release config everything works, but not when I build the debug or staging config. In these cases I get the following errors:
I have tried to fix it by
set Target => Info => Executable file to $(PRODUCT_NAME)
set Target => Bundler Loader to => $(BUILT_PRODUCTS_DIR)/$(PRODUCT_NAME).app/$(PRODUCT_NAME)
I have cleaned my build folder before each build.
This did not happen before, so it could be related to this issue.
(For now my workaround is to use different app icons in order to distinguish my different build environment - as outlines in the article above)
I have the same issue, too. I use xcode 8 beta 6.
library not found for -lCodePush with build configuration "Staging".
I have fix just re-add libCodePush.a at Linked Framework and Libraries.
Now everything works fine =).
Reacted by Birdgg, Sylvain Friquet, Fabrizio Moscon, Johan Arnör, David Ruisinger, John Ferris, Gabriel Reis, Tim Ma, Bernat Fortet, Arthur Ouaki and 4 more
LOG (@jm555jm) THX for the hint. I had quite a few external libraries and I was desperately trying to unlink and re-link them without any luck. But manually removing and re-adding them in the Link Binary with Libraries section finally solved the issue and my builds are succeeding again.
Reacted by LOG, John Ferris, sergeylaptev, rzrobert and harisoyo
Actually after trying that I found that I was still with the Release scheme.
After changing it to staging, and after removing and re-adding the library it still doesn't work 😞
Same exact error.
Reacted by Amur
Reacted by Amur, Will Prater, The low-key and Romain de Wolff
Not sure if this helps, but I had to do something similar to Anton Filatov (@fannt). Cocopods was overwriting the configurations:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.downcase == 'YourTargetName
target.build_configurations.each do |config|
if config.name.downcase == 'staging'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
end
end
end
Any one having an issue when using tipsi-stripe and having multiple deployments?
My pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
workspace 'appname'
target 'targetNameTests' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for targetName
pod 'AppCenter/Crashes', '~> 1.6.1'
pod 'AppCenter/Analytics', '~> 1.6.1'
pod 'AppCenterReactNativeShared', '~> 1.5.1'
# Stripe
pod 'Stripe', '~> 11.2.0'
target 'targetNameTests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'targetName'
target.build_configurations.each do |config|
if config.name == 'Staging'
config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
end
end
end
I've set Per-configuration Build Products Path for Staging to $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Also I've updated PODS_CONFIGURATION_BUILD_DIR for Staging to ${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME)
Im getting the following:
ld: library not found for -lStripe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hi Amur (@Amurmurmur), I'm sure that problem is still in CONFIGURATION_BUILD_DIR and CONFIGURATION_TEMP_DIR settings. I've just created new ReactNative application, copied your Podfile, actualized it to this:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
workspace 'appname'
target 'Issue426' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# React Native requirements
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Pods for targetName
pod 'AppCenter/Crashes', '~> 1.6.1'
pod 'AppCenter/Analytics', '~> 1.6.1'
pod 'AppCenterReactNativeShared', '~> 1.5.1'
# Stripe
pod 'Stripe', '~> 11.2.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'Issue426'
target.build_configurations.each do |config|
if config.name == 'Staging'
config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
end
end
end
then executed pod install, opened generated appname.xcworkspace in XCode, added new Staging configuration (based on Release configuration), added new Staging scheme, updated Pre-configuration Build Files Path and Pre-configuration Intermediate Build Files Path for both Issue426 and Pods project. After this steps my demo project built successfully.
Please try my steps and if the issue won't be solved provide me with sample project that I could able to reproduce your situation and help to fix it.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
if config.name == 'Staging'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
end
Reacted by flackou, CAI, hh11100, Yuttana K., Ricardo Berdejo, Sodbileg Gansukh, Birdgg, Viktor Krasnohorskiy, ddthuan87, Lucas Bento and 3 more
If anybody is still struggling with this issue - there is a simple way to differentiate between Codepush staging and release keys using the same "Release" configuration if you already do your builds with Fastlane.
You basically need to have these lines in your Info.plist:
and then, assuming you already have different Fastlane lanes for staging and release, add appropriate Codepush key for each lane in form of a gym param:
xcargs: "CODEPUSH_KEY=<your staging/release key>"
The key will be inserted during build process and that's about it!
This approach definitely does not cover all cases, but could be useful for those who are searching for a simplified solution without the need to edit your xcode project file.
Reacted by Yuri Kulikov, Romain de Wolff and Mario
I got it solved and implemented for several projects.
Here is what I did:
add that snippet to the end of Podfile:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
if config.name == 'Staging'
config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == 'Staging'
config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
config.build_settings['PODS_CONFIGURATION_BUILD_DIR'] = '${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME)'
end
end
end
end
Update build paths:
Set Staging value for Per-configuration Build Products Path and Per-configuration intermediate Build Files path to $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME) so it looks the same as Release one
Reinstall pods.
From project root: cd ios && pod deintegrate && pod install
done. Try to archive with that target to test
NOTE: In AppCenter I was having build failures when it's archiving successfully locally for staging target. I got it solved by removing build config from that branch and adding it back, seems like it has some kind of caching issues idk
After creating the new configuration Staging, simply run pod deintegrate && pod install inside the ios folder of your Project. CocoaPods will then create all configurations on its own.
For what it's worth, there are a few easier ways to handle this issue, after attempting without success to add a configuration, I decided it was overkill for a single value change.
Method 1: Use info.plist variable substitution, xcargs a and a default value (post xcode 11.4)
Set the deployment key to $(CODEPUSH_KEY:default=209348572039487520934875) in info.plist
We use fastlane, so calling gym/build_app with xcargs injected in from env looks like this:
Target -> Build Phases -> Click plus -> New Run Script Phase.
add something like this: plutil -replace CodePushDeploymentKey -string $CODEPUSH_KEY ./APPNAME/Info.plist
Method 3: Set in JavaScript
did you know there is a setDeploymentKey method in the plugin for both iOS and Android? No? Cool, wasn't just me.
Turns out you can just pass in some configuration when starting your app, like this. This way the keys can live in your code, or however you are dealing with env vars on the javascript side. We use react-native-config, and have a staging and production env file.
After creating the new configuration Staging, simply run pod deintegrate && pod install inside the ios folder of your Project. CocoaPods will then create all configurations on its own.
Activity
geof90 commentedon Jul 12, 2016
Daniel Dunderfelt (@danieldunderfelt) Thanks for the feedback. I will see how we can improve the documentation.
When you created the staging project configuration, did you also manually create a Staging scheme?
danieldunderfelt commentedon Jul 12, 2016
Hi!
No, that was created when I copied the release config and made the staging config.
geof90 commentedon Jul 13, 2016
Daniel Dunderfelt (@danieldunderfelt) Unfortunately I was unable to repro the error you were seeing.
After duplicating the release config and calling it staging + setting up the CODEPUSH_KEY config, all I did was go to Product > Scheme > Edit Scheme then set the Build Configuration to Staging. After that I ran the app and it was sync-ing against CodePush with the Staging key just fine.
What version of XCode are you on? I don't know if that matters but I'm using v7.1.1.
Also are you using CocoaPods for dependency management?
danieldunderfelt commentedon Jul 14, 2016
Geoffrey Goh (@geof90) No, not using CocoaPods. Does it manage these things for me?
When I figured out why my builds weren't working, that the third-party packages didn't have a staging config, I thought having cocoapods wouldn't matter.
geof90 commentedon Jul 14, 2016
Daniel Dunderfelt (@danieldunderfelt) no I only asked because I wasn't using CocoaPods and I was wondering if you were.
danieldunderfelt commentedon Jul 14, 2016
Geoffrey Goh (@geof90) oh, good good!
Maybe your xcode made staging config for your third-party packages, and my xcode glitched out and didn't?
thorbenandresen commentedon Jul 15, 2016
Nice, this did also fix it for me. I omitted the Step 3 (changing the project.pbxproj) and my Fabric.framework does still work fine.
However when I use different PRODUCT_NAMES for the different build environment, I am getting now a build error. I am have setup the names according to this article
When i build my
releaseconfig everything works, but not when I build thedebugorstagingconfig. In these cases I get the following errors:I have tried to fix it by
$(PRODUCT_NAME)$(BUILT_PRODUCTS_DIR)/$(PRODUCT_NAME).app/$(PRODUCT_NAME)I have cleaned my build folder before each build.
This did not happen before, so it could be related to this issue.
(For now my workaround is to use different app icons in order to distinguish my different build environment - as outlines in the article above)
FernandoMorais commentedon Jul 19, 2016
Here I solved the staging problem by correcting the TEST_HOST which is pointing to a fixed value despite the new PRODUCT_NAME.
I've changed the scheme to use the staging variation for tests builds.
I hope it helps!
huitsing commentedon Jul 29, 2016
Our solution might be helpful here as well: https://zeemee.engineering/how-to-set-up-multiple-schemes-configurations-in-xcode-for-your-react-native-ios-app-7da4b5237966#.pxa41apg1
FernandoMorais commentedon Aug 16, 2016
really nice Pete Huitsing (@huitsing)! Much more complete solution!
jm555jm commentedon Aug 18, 2016
I have the same issue, too. I use xcode 8 beta 6.
library not found for -lCodePush with build configuration "Staging".
I have fix just re-add libCodePush.a at Linked Framework and Libraries.
Now everything works fine =).
davidruisinger commentedon Nov 14, 2016
LOG (@jm555jm) THX for the hint. I had quite a few external libraries and I was desperately trying to unlink and re-link them without any luck. But manually removing and re-adding them in the
Link Binary with Librariessection finally solved the issue and my builds are succeeding again.bernatfortet commentedon Feb 1, 2017
LOG (@jm555jm) @flavordaaave thanks for the tip!
It took me a couple minutes to figure out exactly how to do that, so for others:
targetGeneralTabLink Binary with LibrarieslibCodePush-minus button at the bottom left+plus button and search forlibCodePush👍
bernatfortet commentedon Feb 1, 2017
Actually after trying that I found that I was still with the Release scheme.
After changing it to staging, and after removing and re-adding the library it still doesn't work 😞
Same exact error.
Amurmurmur commentedon Feb 2, 2017
+1 Same error, with the header, when on Staging Scheme :(
10 remaining items
jpaolini commentedon May 11, 2018
Not sure if this helps, but I had to do something similar to Anton Filatov (@fannt). Cocopods was overwriting the configurations:
aligfl commentedon May 11, 2018
Someone posted a solution on another thread. Which has worked for me locally + CI (buddybuild)
Solution: react/react-native#11813 (comment)
Amurmurmur commentedon Jun 23, 2018
Any one having an issue when using tipsi-stripe and having multiple deployments?
My pod file
I've set
Per-configuration Build Products Pathfor Staging to$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)Also I've updated
PODS_CONFIGURATION_BUILD_DIRfor Staging to${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME)Im getting the following:
NickToropov commentedon Jun 25, 2018
Hi Amur (@Amurmurmur), I'm sure that problem is still in
CONFIGURATION_BUILD_DIRandCONFIGURATION_TEMP_DIRsettings. I've just created new ReactNative application, copied your Podfile, actualized it to this:then executed
pod install, opened generatedappname.xcworkspacein XCode, added newStagingconfiguration (based on Release configuration), added newStagingscheme, updatedPre-configuration Build Files PathandPre-configuration Intermediate Build Files Pathfor both Issue426 and Pods project. After this steps my demo project built successfully.Please try my steps and if the issue won't be solved provide me with sample project that I could able to reproduce your situation and help to fix it.
jerson commentedon Jul 7, 2018
for me worked with
pppluto commentedon Nov 10, 2018
for me i just need set like this
AlgirdasVZ commentedon Apr 5, 2019
If anybody is still struggling with this issue - there is a simple way to differentiate between Codepush staging and release keys using the same "Release" configuration if you already do your builds with Fastlane.
You basically need to have these lines in your Info.plist:
and then, assuming you already have different Fastlane lanes for staging and release, add appropriate Codepush key for each lane in form of a gym param:
The key will be inserted during build process and that's about it!
This approach definitely does not cover all cases, but could be useful for those who are searching for a simplified solution without the need to edit your xcode project file.
nikopolidi commentedon Aug 30, 2019
I got it solved and implemented for several projects.
Here is what I did:
Set Staging value for Per-configuration Build Products Path and Per-configuration intermediate Build Files path to
$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)so it looks the same as Release oneFrom project root:
cd ios && pod deintegrate && pod installNOTE: In AppCenter I was having build failures when it's archiving successfully locally for staging target. I got it solved by removing build config from that branch and adding it back, seems like it has some kind of caching issues idk
JimmyDLA commentedon Dec 10, 2019
can anyone tell me where I can find my
BUILD_DIRandEFFECTIVE_PLATFORM_NAME?Vitaliy (@nikopolidi) MrPluto Gerson Alexander Pardo Gamez (@jerson) Sergey Akhalkov (@sergey-akhalkov) Alexandre Moureaux (@Almouro) Amur (@Amurmurmur),
Amurmurmur commentedon Dec 11, 2019
Jimmy De Los Angeles (@JimmyDLA) You can find it in Xcode
https://stackoverflow.com/a/11657874
chj-damon commentedon Jun 10, 2020
none of these answers solve my problem.
TwR-Slice commentedon Aug 19, 2020
Just an FYI what worked in my case:
After creating the new configuration Staging, simply run
pod deintegrate && pod installinside theiosfolder of your Project. CocoaPods will then create all configurations on its own.Staging Build -> Success
Staging Archive -> Success
Release Build -> Success
Release Archive -> Success
tabrindle commentedon Apr 16, 2021
For what it's worth, there are a few easier ways to handle this issue, after attempting without success to add a configuration, I decided it was overkill for a single value change.
Method 1: Use info.plist variable substitution, xcargs a and a default value (post xcode 11.4)
$(CODEPUSH_KEY:default=209348572039487520934875)in info.plistbuild_app(scheme: "Release", export_method: "app-store", xcargs: "CODEPUSH_KEY='#{ENV["CODEPUSH_KEY"]}'"Method 2: Use a Run Script
plutil -replace CodePushDeploymentKey -string $CODEPUSH_KEY ./APPNAME/Info.plistMethod 3: Set in JavaScript
Voila, it works. And you can go back to hating Apple, Xcode and everything associated with them in peace.
MRezaBaiat commentedon Feb 1, 2022
i had the same problem but went away after i ran
pod install --repo-updateGamote commentedon May 31, 2023
After following the Multi-Deployment Testing guide we encounter similar errors. They were fixed by
pod deintegrate && pod install. Thank you.