comment build une cible agrégée pour une bibliothèque dynamic qui contient des dependencies comme des cocoapodes

J'essaye de faire une bibliothèque dynamic d'ios. Cette bibliothèque contient beaucoup de dependencies installées using cocoapods.I l'a construit avec le model de bibliothèque dynamic d'ios habituel et je peux l'employer dans d'autres projets où cela fonctionne seulement pour une architecture simple. Maintenant je besoin de travailler pour toutes les architectures et donc besoin de créer une cible agrégée.Cependant, le script de la cible globale que j'ai obtenu ne comprend pas les dependencies cocoapods et quand je comstack l'agrégat je reçois des erreurs comme des files dans la dépendance non trouvée. j'utilise.

# Merge Script # 1 # Set bash script to exit immediately if any commands fail. set -e # 2 # Setup some constants for use later on. FRAMEWORK_NAME="MyProject" # 3 # If remnants from a previous build exist, delete them. if [ -d "${SRCROOT}/build" ]; then rm -rf "${SRCROOT}/build" fi # 4 # Build the framework for device and for simulator (using # all needed architectures). xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch arm64 -arch armv7 -arch armv7s only_active_arch=no defines_module=yes -sdk "iphoneos" xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch x86_64 -arch i386 only_active_arch=no defines_module=yes -sdk "iphonesimulator" # 5 # Remove .framework file if exists on Desktop from previous run. if [ -d "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" ]; then rm -rf "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" fi # 6 # Copy the device version of framework to Desktop. cp -r "${SRCROOT}/build/Release-iphoneos/${FRAMEWORK_NAME}.framework" "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" # 7 # Replace the framework executable within the framework with # a new version created by merging the device and simulator # frameworks' executables with lipo. lipo -create -output "${HOME}/Desktop/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" "${SRCROOT}/build/Release-iphoneos/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" "${SRCROOT}/build/Release-iphonesimulator/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" # 8 # Copy the Swift module mappings for the simulator into the # framework. The device mappings already exist from step 6. cp -r "${SRCROOT}/build/Release-iphonesimulator/${FRAMEWORK_NAME}.framework/Modules/${FRAMEWORK_NAME}.swiftmodule/" "${HOME}/Desktop/${FRAMEWORK_NAME}.framework/Modules/${FRAMEWORK_NAME}.swiftmodule" # 9 # Delete the most recent build. if [ -d "${SRCROOT}/build" ]; then rm -rf "${SRCROOT}/build" fi 

dans un autre blog https://github.com/jverkoey/iOS-Framework/#developing-the-framework-as-a-dependent-project

J'ai trouvé qu'au lieu d'utiliser le projet, nous devons build l'espace de travail en remplaçant

 # Build the other platform. xcrun xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION 

avec

 xcrun xcodebuild ONLY_ACTIVE_ARCH=NO -workspace "${PROJECT_DIR}/${PROJECT_NAME}.xcworkspace" -scheme "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION 

Cependant, cela ne fonctionne pas pour moi et lance des erreurs. Quelle est la bonne façon de build un agrégat pour un projet ayant des dependencies?

cela a fonctionné avec le script suivant.

 UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal # make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" # Step 1. Build Device and Simulator versions xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build # Step 2. Copy the framework structure (from iphoneos build) to the universal folder cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" # Step 3. Copy Swift modules from iphonesimulator build (if it exists) to the copyd framework directory SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/." if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule" fi # Step 4. Create universal binary file using lipo and place the combined executable in the copyd framework directory lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" # Step 5. Convenience step to copy the framework to the project's directory cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}" # Step 6. Convenience step to open the project's directory in Finder open "${PROJECT_DIR}"