Build framework for multiple architectures (arm64, armv7, armv7s)

耗尽温柔 提交于 2020-02-01 15:35:10

问题


I'm trying to upload to TestFlight a project build for arm64, armv7, and armv7s. It is using a framework from another project. But the frameowork appears to be built only for arm64 and not arm64 (file was built for arm64 which is not the architecture being linked (armv7)).

The question is how do I make the framework containing all architectures? I want to keep the projects separated. And I don't care for simulators. I want to make sure it is built for release.

This is the framework target:

EDIT: My project is Cordova based. So it is using a plugin which utilize a pre-built framework. There are instructions out there for building a fat framework, containing simulators and device, then concatenating it with lipo. What I need is the architecture from the device I don't have as well. Does that actually mean I need three devices from arm64, armv7, and armv7s to be able to concatenating them altogether?


回答1:


Apple has discontinued support for 32-bit in iOS 11. You can neither run 32 bit apps on iOS 11 nor run iOS 11 on 32 bit processors. Thus, you have to set your Deployment Target to an iOS version earlier than iOS 11 for your framework.




回答2:


You can try to create an aggregate target and write an script which will support all the platform. This is sample script from one of my project.

unset TOOLCHAINS #Xcode 7.3 BUG FIX  http://stackoverflow.com/questions/36184930/xcodebuild-7-3-cant-enable-bitcode

# define output folder environment variable

C_PROJECT_NAME="<<YOUR_FRAMEWORK_NAME>>"

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# Step 1. Build Device and Simulator versions
xcodebuild -target <<YOUR_FRAMEWORK_NAME>> ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

xcodebuild -target <<YOUR_FRAMEWORK_NAME>> ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

rm -rf ./${C_PROJECT_NAME}.framework
cp -R ${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/${C_PROJECT_NAME}.framework ./

# Step 2. Create universal binary file using lipo

lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}"

mv ${UNIVERSAL_OUTPUTFOLDER}/${C_PROJECT_NAME} ./${C_PROJECT_NAME}.framework/${C_PROJECT_NAME}


来源:https://stackoverflow.com/questions/48923793/build-framework-for-multiple-architectures-arm64-armv7-armv7s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!