Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Integration of iOS frameworks in Qt Creator (Qt, QML)

    Mobile and Embedded
    3
    8
    3181
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cochleas.devel last edited by

      Hi all,

      does anyone knows if frameworks like UIKit or iAd can be integrated in Qt Creator?
      I want to use them in a Qml app.

      Thanx,
      Cochleas

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        What do you mean by integrated in Qt Creator ? Write your software to use Apple's frameworks ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • C
          cochleas.devel last edited by

          Yes. For example add in the *.pro file something to include the frameword, e.g.g the iAd.framework and then in the *.h and *.cpp file
          to include the header and use the class objects.

          Even in the qml it would be interesting...

          1 Reply Last reply Reply Quote 0
          • Gianluca
            Gianluca last edited by

            I use iOS frameworks in Qt projects and it's very easy ... but you cannot use them from .cpp files because they are objective-C classes, so you have to add a .mm file to the project.
            And for use them in QML it's very easy: create a QObject subclass, implement it into an .mm file where you wrap any method you like of the framework and register the QObject for use it in QML.

            In .pro files I use the following directive:
            @

            This flag is necessary otherwise you get an link error

            I open a bug reports for that

            QMAKE_LFLAGS += -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks

            Add the framework you need

            LIBS += -framework AdSupport -framework StoreKit

            the objective sources should be put in this variable

            OBJECTIVE_SOURCES += backend_ios.mm
            @

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Then the quickest is to take a look at QtMacExtras, you'll see how it's setup to work with frameworks.

              You can't write Objective-C/C++ in qml files. You'll have to create a derived QObject class that you will use to call native functions/methods/etc...

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • C
                cochleas.devel last edited by

                Thank you guys!!!
                I will check these and come back if I have still problems...

                Thanks a lot!

                1 Reply Last reply Reply Quote 0
                • C
                  cochleas.devel last edited by

                  Hi Gianluca and SGaist,

                  as I am new into this field I would need some more help:

                  To Gianluca:
                  Could you please post an example of such a subclass implementation in the *.mm file? Also what I have to put in the backend_ios.mm?

                  To SGaist:
                  Could you also please post an example of creating a derived class?

                  Thanks in advance for your guidance!

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    Take a look at the QtMacExtras module and the cocoa platform plugins, they show it nicely

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post