1

I am creating Framework, I used aggregate target in that framework where we can write shell script to Build the framework for device as well as simulator based on script based on that i will have executable framework that can be imported in any project and we can use that class and method of framework.

But issue is that when we create executable framework with "schema device" then i can able to run on all device but if i make build using particular iOS5/iOS6 simulator then it will run only selected iOS5/iOS6 simulator in client project.

if i have created framework build using iOS5 simulator and if i run that framework in client project and i used iOS6 simulator it gives Undefined symbols for architecture x86_64.

I need shell script which support both architecture i386 and x86_64 means my framework should be executable for all device and all simulator in client project.

Any insights into this would be really helpful.

1 Answers1

1

Create aggregate target and inside its Build Phases -> Run script write script to:

Build 2 separate frameworks: 1. Framework with architectures for mobile devices (armv7, arm64, etc.) 2. Framework with architectures for simulator (i386 and x86_64).

For example:

xcodebuild -workspace MyApp.xcworkspace -scheme MyFrameworkScheme -arch i386 -arch x86_64 ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator BUILD_DIR=${BUILD_DIR}

xcodebuild -workspace MyApp.xcworkspace -scheme MyFrameworkScheme -arch armv7 -arch armv7s -arch arm64 ONLY_ACTIVE_ARCH=NO -sdk iphoneos -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos BUILD_DIR=${BUILD_DIR}

Then, use lipo to merge the libraries inside both frameworks to a fat library, and replace one of them inside the framework => you have a fat framework.

Milan Markovic
  • 1,250
  • 13
  • 18