Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Integration of iOS frameworks in Qt Creator (Qt, QML)
does anyone knows if frameworks like UIKit or iAd can be integrated in Qt Creator?
I want to use them in a Qml app.
What do you mean by integrated in Qt Creator ? Write your software to use Apple's frameworks ?
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...
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
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...
Thank you guys!!!
I will check these and come back if I have still problems...
Thanks a lot!
Hi Gianluca and SGaist,
as I am new into this field I would need some more help:
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?
Could you also please post an example of creating a derived class?
Thanks in advance for your guidance!
Take a look at the QtMacExtras module and the cocoa platform plugins, they show it nicely