Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt depended library in native iOS app (main event loop question)
bludger last edited by
Currently I'm working on a library which is heavily depended on Qt (networking part mainly). One of the goals is to share this lib among a variety of platforms including iOS. As I'm working towards the moment to bring all the components together I stumbled upon some issues regarding iOS and the lib. Main problem for now is that the lib needs a QCoreApplication (thus the Qt's event loop) and I'm not sure how to get that. Last days I read a lot regarding this and most of it seems to be out-dated / not relevant anymore. Problems arise because we use XCode for the native look and feel of the app, it also provides a main.m which initiates the UIApplicationMain.
So, how can I get the QCoreApplication when the app already have a main loop provided by XCode (UIApplicationMain) or how can I replace it or attach to it?
Subclassing QThread and initiate a QCoreApplication within the subclass won't work because Qt will complain about the fact it wasn't created in the main thread which is required by Qt. Note that the lib doesn't do anything with the Gui at all, it contains most of the BL like communicating with webservices etc.
Thanks in advantage.