Important: Please read the Qt Code of Conduct -

Qt User Plugins & iOS

  • Qt Champions 2017

    Hi All

    I have developed Custom Qt Plugins( and used QPluginLoader to load the plugin in Android. It works fine..

    How to use the same plugin in iOS ?. I know iOS talks about static plugin etc. When I build the same plugin using iOS kit, it build libDataStore.a. This is static lib.

    How do i use this in iOS ? How to bundle this ? Does QPluginLoader works for this ? See the following sample code

    QPluginLoader loader;
            qDebug() << Q_FUNC_INFO << " Plugin load successfull" << endl;
            QObject *obj = loader.instance();
            if (obj==NULL){
                qCritical() << "Plugin load failed. Please check "<<endl;return;
            IDataStore *collector = qobject_cast<IDataStore*>(obj);
        }else {
            qCritical() <<"Plugin load failed. Please check ="<< endl;return;
    Any inputs on this.

  • Lifetime Qt Champion


    It's explained here.

    Just in case and IIRC, since Qt 5.9, you should also be able to build Qt dynamically on iOS but it's not yet currently fully automated for the bundling part so you might want to stay with the default current static build.

  • Qt Champions 2017

    Thank @SGaist . Here is the complete info if somebody requires.

    Plugin Side -

    1. First build your Qt plugin as static lib. For this place the following configuration in your plugin pro file.
      CONFIG +=plugin static
    2. My Plugin name is libDataStore.a & class name of the plugin is DataStore & Interface name is IDataStore
    3. Inside the constructor of DataStore, set the object name
      e.g this.setObjectName("DataCollectorPlugin")
    4. libDataStore.a is present in the directory called /Users/dheeru/Qt/bins

    App Side -

    1. Place the configuration in application pro file like this
      LIBS += -L/Users/dheeru/Qt/bins -lDataStore
    2. Q_IMPORT_PLUGIN(DataStore) in main.cpp. Argument for the macro should match the classname
    3. Use QPluginLoader::staticInstances function. This will return the QObjects list. Since there may be many plugins, objectName is useful here.
    4. After this type cast the required object to Appropriate interface.
    QObjectList objList = QPluginLoader::staticInstances();
        foreach(QObject *obj1, objList){
            qDebug() <<" IOS Load successful =" << obj1->objectName() << endl;
            IDataStore *collector = qobject_cast<IDataStore*>(obj1);

    Once you have object with you, rest of the process is same.

Log in to reply