Reputation: 16271
A lot of iOS 3rd Party frameworks are built around custom frameworks, that you are going to integrate in your dependent app. Before the new iOS Embedded Framework that only works in iOS8 (see my post here), there were two elegant solution for that (when you do not choose to create your scripts for a matter of time and knowledge on that)
The iOS Universal Framework by kstenerud
and
The iOS Framework by jverkoey
They both worked and were good solution when have to create a .framework to distribute a solution for your clients.
As soon as Xcode6 came out, I was not able to make the first to work due to compilation errors of different kind (see here for details).
So I moved to the iOS Framework, and with my surprise it still works on XCode6.
So this advice is for the ones that are struggling with iOS Universal Framework and do not find any solution to make it works on Xcode6.
Since as depicted in 1 there is now way for Apple to accept Embedded Frameworks if your deployment target is >= iOS7, this is the best custom solution at the moment, and a fix for the iOS Universal Framework could help as well. All the issues I have found on it are depicted in 5.
Upvotes: 4
Views: 3774
Reputation: 540
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
Upvotes: 4
Reputation: 6181
You can use Xcode 6 Universal Framework in iOS 7, - see my answer here
Upvotes: 0