I have a workspace with a project which links with the static libraries in another project (which is also in the workspace). It\'s a problem in Kobold2D I haven\'t been able
You could add CONFIGURATION_BUILD_DIR=/Some/Shared/Dir before running xcodebuild. For example:
cd SOURCE_DIR
xcodebuild -workspace YourProject.xcworkspace -scheme YourScheme -configuration AdHoc -sdk iphoneos clean build CONFIGURATION_BUILD_DIR="`pwd`"/build
Usually I have an AppStore
scheme (mapped to my AppStore
config).
One thing that happened to me, was this case sensitive issue that was making Cocoapods to generate a build folder for Pods.build
inside Release-iphonesimulator
(as a fallback) instead of AppStore-iphonesimulator
.
I guess I miss-clicked when I linked the scheme and config and only removing it and re-adding made me understand what went wrong. Check the diff.
I was using cocoapods 0.38.2, so this was clearly a user mis-configuration and not a Cocoapods issue that was resolved on 0.34
My framework is built using another SDK project inside my app project. First I have a "Debug" and "Release", then I add a new "TestFlight" configuration. I can't archive with that new one. I ended up adding a new build configuration with the same name in the SDK project. In other words, I ended up adding "TestFlight" configuration to BOTH my app and SDK projects. Now Archive works.
I'm not sure if it's the best way to do it. But it looks clean enough to me for now. :)
Oh, and for Cocoapods, after you duplicate the configuration, if you run pod install
right away you will get this yellow warning:
[!] 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 ...
You have to go to the Project, "Info" tab, "Configurations" section, select the new configuration you just created, and set "Pods.release" of all targets to "None" first. After that, you can run pod install
safely.
As said in similar question iOS Static Library as a Subproject of a Project That Has Custom Build Configurations?, the fix is to add this line
$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
to your target's Framework Search Paths
, Header Search Paths
and/or Library Search Paths
I have a similar problem using CocoaPods and trying to have more than one Adhoc (or Enterprise, or Beta) configurations.
Here is what seems to work (let's say that both projects are lying in the same xcworkspace):
Add the subproject
generated lib to the mainproject
Link Binary with Libraries.
As the configuration Adhoc
is not known by the subproject
, Xcode will use the Release
config as a fallback (or maybe the first config of the list) when building it.
The linker will complain because it cannot find the lib… ok, let's handle this one.
Add a Run Script build phase to the mainproject
, right after the Target Dependencies phase. Enter this script:
if [ "$CONFIGURATION" = "Adhoc" ]; then
echo "====================================="
echo "Copying libPods Release into the Adhoc product build dir!"
echo "====================================="
cp "$BUILT_PRODUCTS_DIR/../Release-$PLATFORM_NAME/libPods.a" "$BUILT_PRODUCTS_DIR"
else
echo "No manual lib copy."
fi
This will copy the lib generated by the subproject
Release
build (which will happen when mainproject
is built) in the Adhoc
build directory, so that the linker will find the lib. And we should be good to go! Yeah!
Here's something that works for me.
In the project with the Adhoc build configuration, override the "Per-configuration Build Products Path" (CONFIGURATION_BUILD_DIR) and "Per-configuration Intermediate Build Files Path" (CONFIGURATION_TEMP_DIR) for the Adhoc build configuration to use the same folder as the release configuration.
Adhoc: CONFIGURATION_BUILD_DIR = $(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
Adhoc: CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Now when you do an Adhoc build, Xcode will put libFoo.a and Bar.app in the Release-iphoneos folder. The linker will be happy and you can use -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a as usual.
Alternatively, you can add the Release-iphoneos folder to the library search paths for the Adhoc build configuration:
Adhoc: LIBRARY_SEARCH_PATHS = $(inherited) $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
But then you'll have to set a different -force_load for each build configuration:
Debug: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a
Adhoc: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Release: OTHER_LINKER_FLAGS = $(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a