I'm Developing an universal framework for iOS , which used realmSwift as it dependency install by cocoapod .
need to distribute myFramework as universal framework over cocoapod .
Expected Results
The output of universal framework should support and run in all iOS architectures means both device and simulator .
Actual Results
Only build for device architectures , and produce errors :
"could not find module ''RealmSwift" for architecture 'armv7'; found: arm64"
"no such module 'RealmSwift'"
Steps to Reproduce
1) Create new empty workspace
2) Add new project > iOS > cocoa Touch framework , and add it to workspace
3) close workspace
4) Open terminal . , go to workspace directory and write touch podfile and open pod file .
5) Add following lines on podfile
workspace 'workspaceName'
use_frameworks!
target 'MyFramework-iOS' do
platform :ios, '10.0'
pod 'RealmSwift'
project 'MyFramework-iOS/MyFramework.xcodeproj'
end
6) pod install
7) open workspace
8) add new Target > crossPlatform -> Aggregate
9) add new Run script phase
10) add universal framework script
11) build universal framework selected Generic iOS Device
SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-${DEVICE_SIMULATOR}/${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
Goals
I'm Developing an universal framework for iOS , which used realmSwift as it dependency install by cocoapod . need to distribute myFramework as universal framework over cocoapod .
Expected Results
The output of universal framework should support and run in all iOS architectures means both device and simulator .
Actual Results
Only build for device architectures , and produce errors :
"could not find module ''RealmSwift" for architecture 'armv7'; found: arm64" "no such module 'RealmSwift'"
Steps to Reproduce
1) Create new empty workspace 2) Add new project
> iOS> cocoa Touch framework , and add it to workspace 3) close workspace 4) Open terminal . , go to workspace directory and write touch podfile and open pod file . 5) Add following lines on podfile6) pod install 7) open workspace 8) add new Target
> crossPlatform -> Aggregate 9) add new Run script phase 10) add universal framework script 11) build universal framework selected Generic iOS DeviceUniversal Framework script
RELEASE_TYPE="RELEASE" FRAMEWORK_VERSION="NOTRIAL_VERSION"
UNIVERSAL_TARGET="iOS" UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal-${UNIVERSAL_TARGET} UNIVERSAL_FRAMEWORKFOLDER=${PROJECT_NAME}-${RELEASE_TYPE}/${UNIVERSAL_TARGET} DEVICE_OS="iphoneos" DEVICE_SIMULATOR="iphonesimulator"
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" mkdir -p "${UNIVERSAL_FRAMEWORKFOLDER}"
xcodebuild -target "${PROJECT_NAME}-${UNIVERSAL_TARGET}" ONLY_ACTIVE_ARCH=NO
configuration ${CONFIGURATION}sdk ${DEVICE_OS} BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_SWIFT_FLAGS="-D ${FRAMEWORK_VERSION}" clean build xcodebuild -target "${PROJECT_NAME}-${UNIVERSAL_TARGET}" VALID_ARCHS="x86_64 i386"configuration ${CONFIGURATION}sdk ${DEVICE_SIMULATOR} ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_SWIFT_FLAGS="-D ${FRAMEWORK_VERSION}" clean buildcp -R "${BUILD_DIR}/${CONFIGURATION}-${DEVICE_OS}/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-${DEVICE_SIMULATOR}/${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
lipo
create ~~output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-${DEVICE_SIMULATOR}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}~~${DEVICE_OS}/${PROJECT_NAME}.framework/${PROJECT_NAME}"cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${UNIVERSAL_FRAMEWORKFOLDER}/"
open "${UNIVERSAL_FRAMEWORKFOLDER}/"
if [ -d "${SRCROOT}/build" ]; then rm -rf "${SRCROOT}/build" fi
Version of Realm and Tooling
Realm framework version: 3.14.1
Xcode version: 10.2.1
iOS version : 10.0
Swift version : 4.2