As showed in the screen above, I couldn't find any xcodebuild command line to add/remove the embed frameworks, is there any way we can do so via command line (to remove or add the line)? As I need to automate the build process.
As showed in the screen above, I couldn't find any xcodebuild command line to add/remove the embed frameworks, is there any way we can do so via command line (to remove or add the line)? As I need to automate the build process.
For conditionally embedding frameworks to your app you should make a script under Build Phases that copies your dynamic library to Frameworks folder of your app and then sign it e.g.:
# Path to your framework to copy. You must have two compiled versions: Debug(arm64, x86_64) and Release(arm64).
FRAMEWORK=".../$CONFIGURATION/MyFramework.framework"
# Frameworks folder of your app
NAME=$(basename $FRAMEWORK)
DESTINATION=${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$NAME
# Copy (if needed) and sign
if [ ! -d $DESTINATION ]; then
cp -r $FRAMEWORK $DESTINATION
codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements $DESTINATION
fi
For xcframework you can specify subfolder path in additional for a target arch:
# Release device only
if [ $PLATFORM_PREFERRED_ARCH == "arm64" ]; then
FRAMEWORK=".../MyFramework.xcframework/ios-arm64/MyFramework.framework"
fi