Here step to create static cocoa touch framework in Xcode 6.
Open Xcode and create a new static framework project by clicking File\New\Project and selecting iOS\Framework and Library\Cocoa Touch framework.
You can provide your framework name and save the project to an empty directory.
Automatically umbrella header created for our framework. In this header , you should import all the public headers of our framework using the statements like #import
A static framework project is made up of header files and implementation files, which are compiled to make the framework itself. You can create the class by using the Cocoa Touch class.
Verifying Your Build Settings Go to the Build Settings of your project Target and confirm or set the “Architectures” to “Standard Architectures.” These are arm64 and armv7, and are likely the default. As well as, Also we need to set the few architectures in setting, because iOS apps need to run on many different architectures.
armv7: Used in the oldest iOS 7-supporting devices armv7s: As used in iPhone 5 and 5C arm64: For the 64-bit ARM processor in iPhone 5S i386: For the 32-bit simulator x86_64: Used in 64-bit simulator
This means that builds are as fast as they can be. When you archive an app or build in release mode, then Xcode will build for all ARM architectures, thus allowing the app to run on most devices.
Mach-O setting: Static library:
Final Build project:
Aggregate target to combine the device and simulator framework by using lipo, you can add the below script to your aggregate target.
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework"
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal"
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -arch i386 -arch x86_64 -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator | echo
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -arch arm64 -arch armv7 -arch armv7s -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos | echo
rm -rf "${UNIVERSAL_LIBRARY_DIR}"
mkdir "${UNIVERSAL_LIBRARY_DIR}"
mkdir "${FRAMEWORK}"
cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}"
lipo "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}""${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -create -output"${FRAMEWORK}/${FRAMEWORK_NAME}" | echo