1

i'd like to mention this question Include a framework into another one, is it possible? and this Include an iOS Framework into another one.

Also there is a similar to the target question from me as well, https://stackoverflow.com/questions/23022211/create-framework-including-plcrashreporter-linked-xcodeproj-source-code-to-the.

I want to achieve the same thing. Don't want the developer to have to link to both frameworks but only mine which is merged with the other.

Both questions in the link have no answer. Any update on the subject?

P.S. I have the source code also but this is not an option since it introduces several problems.

How can I do it, any tutorials, blog, book etc?

Thank you.

Community
  • 1
  • 1
George Taskos
  • 8,324
  • 18
  • 82
  • 147

2 Answers2

0

Yes, it is possible to include a .framework in a .framework. I've never done it, but i know coacoapods does that and older version of parse framework used to include the facebookSDK so you could start researching into how parse did it, by downloading older versions of parse.

This doesn't answer the question so i will delete it when an answer is posted, but at least you have a information you could use to do research to find the answer :D

Here try using this Wenderlich Tutorial to make a static library. From there you can start toying around with the settings. Make sure that any framework you create has the #import statement in the main header file. You know the -Project/Project.h- that is common in most frameworks, in that .h file have all the import statements.

A'sa Dickens
  • 2,045
  • 1
  • 16
  • 21
  • Yes it doesn't, but at least is something than nothing. Will try to find the Parse xcode project, is the source code public? – George Taskos Apr 16 '14 at 15:14
  • man stack overflow was deleting the Project/Project.h thing when i tried using <> or `` … how inconvenient – A'sa Dickens Apr 16 '14 at 15:27
  • I am aware about this tutorial, I also have their books, but this is how to create a universal static library, it misses the step to create a .framework. I will try to add the header in a base class I have public in the settings -> Build Phases -> Copy Headers section. Also I use these scripts to generate a framework, https://github.com/jverkoey/iOS-Framework, any other resources about that? are you experienced in such a task? – George Taskos Apr 16 '14 at 15:41
  • Nope, i'm more accustomed to git submodules ): – A'sa Dickens Apr 16 '14 at 16:10
  • Those Git submodules, you mean linking the .xcodeproj to you project and it is included in your static library? – George Taskos Apr 16 '14 at 16:18
  • Nope, it's having a separate repository contain a project that you download into your project via git submodule add git@gitlink and then git submodule update --init – A'sa Dickens Apr 16 '14 at 16:23
  • it's the equivalent of importing a separate project into your project – A'sa Dickens Apr 16 '14 at 16:24
0

I have found the solution creating an aggregate target and adding the following run script in the build phase section.

I will name the static library target name as StaticLibraryName for the example.

xcodebuild -project "StaticLibraryName.xcodeproj" -configuration "Release" -target "StaticLibraryName" -sdk iphoneos
xcodebuild -project "StaticLibraryName.xcodeproj" -configuration "Release" -target "StaticLibraryName" -sdk iphonesimulator

mkdir -p "${SRCROOT}/Products/StaticLibraryName.framework"
mkdir -p "${SRCROOT}/Products/StaticLibraryName.framework/Versions"
mkdir -p "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A"
mkdir -p "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/Resources"
mkdir -p "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/Headers"

ln -s "A" "${SRCROOT}/Products/StaticLibraryName.framework/Versions/Current"
ln -s "Versions/Current/Headers" "${SRCROOT}/Products/StaticLibraryName.framework/Headers"
ln -s "Versions/Current/Resources" "${SRCROOT}/Products/StaticLibraryName.framework/Resources"
ln -s "Versions/Current/StaticLibraryName" "${SRCROOT}/Products/StaticLibraryName.framework/StaticLibraryName"

cp -R "build/Release-iphoneos/usr/local/include/" "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/Headers/"

lipo -create "build/Release-iphoneos/libStaticLibraryName.a" "build/Release-iphonesimulator/libStaticLibraryName.a" -output "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/StaticLibraryName"

libtool -static -o "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/TheOtherFrameworkName" "${SRCROOT}/Products/StaticLibraryName.framework/Versions/A/TheOtherFrameworkName" "${SRCROOT}/Vendor/TheOtherFrameworkName.framework/Versions/A/TheOtherFrameworkName"
George Taskos
  • 8,324
  • 18
  • 82
  • 147