How to create an iOS Framework using Xcode 5
Solution 1
This approach works very well:
https://github.com/jverkoey/iOS-Framework#walkthrough
And you can use with CocoaPods (http://cocoapods.org/) with this simple fix: https://github.com/jverkoey/iOS-Framework/issues/46
Just change the xcodebuild line in the Framework target run script:
# Build the other platform.
xcodebuild ONLY_ACTIVE_ARCH=NO -workspace "${PROJECT_DIR}/${PROJECT_NAME}.xcworkspace" -scheme "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION
Solution 2
Creating a framework is not hard, you are probably taking the long way using the template. Follow this steps:
- Mehfuz's Creating Universal IOS Framework
- Cocoanetics Making Your Own iPhone Frameworks. In Xcode.
- Hector Zhao's How to build custom iOS framework with Xcode
The script on the third Blog will give you the structure that Apple recommends, but all of them are great. I managed to build one framework using cocoa pods by setting a preprocessor macro COCOAPODS=1 and adding a user defined config setting PODS_ROOT : "${SRCROOT}/Pods". All of this on the settings of your bundle. You can also try setting the info tab of your Xcode project, under Configurations, to use Pods as your configuration file, but it may give you duplicate symbols, not sure.
Comments
-
Idan about 2 years
How can I create a Framework for iOS, using Xcode 5? I previously used (before Xcode 5) a GitHub project that let me create a Fake Framework. In Xcode 5 it seems that it doesn't work anymore. Any suggestions?
UPDATE: To be clear I'm adding static libraries/frameworks to my framework project AND I want them linked into the produced framework. So I cannot just use the static library template.
-
Sam Spencer almost 11 yearsHere's a detailed SO question on that. I'm not sure if this is still relevant to Xcode 5, but in Xcode 4 this was the correct way to do it (not a hack or a fake framework).
-
-
Idan over 10 yearsThis is what I'm using, Still cannot use arm64 and have serious issues with the script...
-
Boris Vidolov over 10 yearsWhat kind of problems are you experiencing with Cocoapods? Are they documented? This may be a deal breaker for many of us.
-
Renato Silva Das Neves about 10 yearsYes, to create an universal and distributed Framework.