Important: Please read the Qt Code of Conduct -

How to add a ios-framework to qt-project ?

  • I want to add a ios_framework to my qt-project,
    It is located the at /Volumes/Data/SvnData/Codes/Libraries/IOS/MyFramework.framework
    I already set the .pro
    but when I run the app on the IPhone,
    I get a issue , the app was crashed.

    dyld: Library not loaded: @rpath/MyFramework.framework/MyFramework
    Referenced from: /var/containers/Bundle/Application/3BB2B369-0047-4952-B0BE-47EF91019DE9/
    Reason: image not found

    This is my setting of .pro

    QMAKE_LFLAGS += -F/Volumes/Data/SvnData/Codes/Libraries/IOS/MyFramework.framework
    LIBS += -F/Volumes/Data/SvnData/Codes/Libraries/IOS
    LIBS += -framework MyFramework

    What's the wrong? How can i do? Please help me. thanks.

  • Qt Champions 2019

    @Kegin From your description it is not clear what you already did.
    Did you install XCode?
    Did you install Qt for iOS?
    Do you have an iOS Kit in QtCreator?
    Did you successfully build your app?

  • thank your reply.

    I have installed Xcode,
    I think the environment is correct.

    before I don't add the iOS-framework,
    I have successfully run first app on iPhone,

    but when I want add the ios-framework,
    modify my project (.pro),
    add some settings
    it crashed, and could not run...

    Error saying it can't load the ios-framework

    when I want use api of third-party iOS-framework
    how can I change the settings of .pro?

  • Moderators

    a vague answer to a vague question

    LIBS += -framework frameworkName

  • @J.Hilk

    Sorry, may I did not clearly explain my problem.

    So.. if i want to link a third-party ios-framework,
    Just add the “LIBs += ...“ ?

    But i already add the lines to .pro

    LIBS += -F/Volumes/Data/SvnData/Codes/Libraries/IOS
    LIBS += -framework MyFramework

    Before i don’t modify .pro for use ios-framework
    I build the app is successfully
    run the app also is successfully.

    I tried..
    I include the header-path of ios-framework in my codes.
    It can found, and it build successlly,
    But when i run it, it crash at running time

    The error is

    dyld: Library not loaded: @rpath/MyFramework.framework/MyFramework
    Referenced from: /var/containers/Bundle/Application/3BB2B369-0047-4952-B0BE-47EF91019DE9/
    Reason: image not found

  • I am trying to link GoogleMobileAds.framework,
    It is working fine

    But I link MyFramework.framework
    It runs and crashes

    I found the difference between two frameworks.
    MyFramework.framework has a file, it is exec

    MyFramework.framework is a dynamically linked shared library.

    0_1560844667759_Screen Shot 2019-06-18 at 3.57.35 PM.png

    0_1560845598968_Screen Shot 2019-06-18 at 3.56.57 PM.png

    According to this article

    Maybe I need to add MyFramework.framework to "Embedded Binaries"? How to set this in QT-Project?

  • @Kegin (and anybody else who stumbles on this), see this comment and mine following it:

    Summarized, you need to spec the framework in QMAKE_BUNDLE_DATA and then add a linker switch to make sure the executable can find it at run time.

Log in to reply