How to create Apple framework for iOS?



  • Is it possible create iOS Apple Framework?

    Here documentation how to create Apple framework: http://doc.qt.io/qt-5/qmake-platform-notes.html#creating-frameworks

    But option:

    CONFIG += lib_bundle
    

    available only for Mac OS X (http://doc.qt.io/qt-5/qmake-variable-reference.html#config)

    XCode allows to create frameworks for all platforms (macOS, iOS, watchOS...).


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That's likely because until recently, Apple was forbidding the use of Frameworks in iOS applications i.e. only static builds (not counting the system Frameworks).

    As for now, you should bring this point to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.



  • Hi!

    As I know for now Qt doesn't have any simple way for create framework for iOS platform. But you can do it yourself. I post a link to article where you can read about how you can create framework from static library in Xcode. If you want you can use bash script from article in your project. The link to article here.

    Also I done a simple script for you (this script works but you need do a few steps to start work with it):

    1. Create a folder where you will run script.

    2. Copy to this folder my script and two version of static libraries: one for device and second for simulator.

    3. Create headers folder and copy to it all your public headers file for your framework.

    4. Open terminal and move to folder which you created in step 1.

    5. Run script with parameters:

      ./generate_framework.sh -framework_path <path_to_framework> -headers <full_path_to_public_headers> -project_name <name_of_framework> -device_lib <path_to_device_static_library> -sim_lib <path_to_simulator_library>

    Why you need two versions of library? Because you need to support both device and simulator. You can use only one lib file but in this case you will build project on ios only for one device or simulator. So I recomend to build both version of library and then use it with my script.

    Hope this will help!



  • Hi Andrew,
    I know this post is quite old, but I am currently struggeling with turning a lib into a framework with qmake. Would you perhaps mind resharing your build script. The old link is dead, but perhpas I can learn from your script what I am doing wrong.
    Many thanks for your help!



  • Hi @Stefankm,

    Sorry, I'm updated the link to archive with script for create framework. Please, use this link.



  • @shav Thanks a lot for your kind help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.