8

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.

Idan
  • 9,880
  • 10
  • 47
  • 76
  • Here's a [detailed SO question on that](http://stackoverflow.com/questions/4065052/how-to-build-a-framework-or-library-for-other-developers-the-secure-way). 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). – Sam Spencer Sep 22 '13 at 16:24

4 Answers4

6

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
3

Creating a framework is not hard, you are probably taking the long way using the template. Follow this steps:

  1. Mehfuz's Creating Universal IOS Framework
  2. Cocoanetics Making Your Own iPhone Frameworks. In Xcode.
  3. 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.

GianPac
  • 462
  • 1
  • 7
  • 18
0

Maybe you take a look into the iOS-Universal-Framework. I´m using it right now and it does the job! You can find it here: ios-universal-framework

The only thing i issued is, that it doesn´t work with Cocoapods. But for all other tasks it is very well!

EDIT: You used it right before, ok. But as i mentioned it works well with xcode 5. It only had problems using cocoapods.

Tomte
  • 1,331
  • 12
  • 19
  • This is what I'm using, Still cannot use arm64 and have serious issues with the script... – Idan Dec 19 '13 at 11:39
  • What kind of problems are you experiencing with Cocoapods? Are they documented? This may be a deal breaker for many of us. – Boris Vidolov Feb 27 '14 at 23:41
0

To create an iOS Framework using Xcode 5 Try this link: http://www.raywenderlich.com/65964/create-a-framework-for-ios

Good tutorial to create framework in iOS.

Ayaz
  • 1,398
  • 15
  • 29