Qt depended library in native iOS app (main event loop question)
-
wrote on 20 Dec 2016, 14:45 last edited by
Hi All!
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.
-
wrote on 22 Jan 2022, 09:12 last edited by
Hi, do you have found a solution for this issue?
I have the same problem an try to start a QCoreApplication in an other thread. On Android, it works even if the QCoreApplication does not run on the main thread.
THX