Problem with custom Plugin for QtQuick on iOS



  • Hi,

    I'm using Qt 5.8 on macOS 10.12.3 and iOS 10.2. I have a project which usage custom QtQuick plugin. I can build this plugin without any issues. Also this plugin work fine for Desktop. When I try to build my iOS application with this plugin (which I build for iOS) I receive error message:

    Starting remote process.
    objc[7095]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x115039998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x114db8880). One of the two will be used. Which one is undefined.
    QML debugging is enabled. Only use this in a safe environment.
    JIT is disabled for QML. Property bindings and animations will be very slow. Visit https://wiki.qt.io/V4 to learn about possible solutions for your platform.
    QQmlApplicationEngine failed to load component
    qrc:/main.qml:3 module "com.shav.uicomponents" plugin "ShavUIComponents" not found
    

    As you can see my plugins can't be found.

    After build my plugin I'm coping it to Qt_instal_dir/5.8/ios/qml folder. This work for Desktop version of my project but doesn't work for iOS. Could someone post step-by-step instruction how to deploy custom plugins for iOS platform?



  • Hi everyone!

    I still have problem with my QML plugin on iOS. I'm using special variable to see what happens with imports path and this is what I see in console:

    Starting remote process.
    objc[4611]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x1160d6998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x115e55880). One of the two will be used. Which one is undefined.
    QML debugging is enabled. Only use this in a safe environment.
    QQmlImportDatabase::addImportPath: "/Users/andrewshapovalov/Library/Developer/CoreSimulator/Devices/C6439E02-F21C-4BCE-80A7-884741DF6D63/data/Containers/Bundle/Application/D44C51FF-9AA9-4EC7-9015-1A003ADE5176/NestleanInstaller.app/qt_qml"
    QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
    QQmlImportDatabase::addImportPath: "/Users/andrewshapovalov/Library/Developer/CoreSimulator/Devices/C6439E02-F21C-4BCE-80A7-884741DF6D63/data/Containers/Bundle/Application/D44C51FF-9AA9-4EC7-9015-1A003ADE5176/NestleanInstaller.app"
    JIT is disabled for QML. Property bindings and animations will be very slow. Visit https://wiki.qt.io/V4 to learn about possible solutions for your platform.
    QQmlImportDatabase::addImportPath: "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml"
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtQuick" 2.7 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick.2/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick.2"
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtQuick.Controls" 1.5 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick/Controls/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick.Controls" from "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick/Controls"
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtQuick.Controls" 2.0 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick/Controls.2/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick.Controls" from "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtQuick/Controls.2"
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    qmlRegisterType requires absolute URLs.
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtGraphicalEffects" 1.0 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtGraphicalEffects/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtGraphicalEffects" from "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/QtGraphicalEffects"
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "com.shav.uicomponents" 1.0 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded "/Volumes/HPDD/Applications/Qt/Qt5.x/5.8/ios/qml/com/shav/uicomponents/qmldir"
    QQmlApplicationEngine failed to load component
    qrc:/qml/main.qml:6 module "com.shav.uicomponents" plugin "ShavUIComponents" not found
    

    If I understand correctly application is loaded my plugin but still can't use it.

    How I can fix this?



  • I have same problem. Did you solve ?



  • Hi,

    Not yet. Still working on it. But if you find something let me know.



  • @shav Sure !



  • I hit this issue and Qt support told me that for iOS, in order to include my custom plugins with the app, I need to add this to my pro file - QMLPATHS += /path/to/plugin

    It is some sort of undocumented qmake variable I guess. It is only required on iOS from my testing.



  • Thanks for the reply!

    I'm tested it and still have the same problem. Your plugin is a static library, right?



  • Build Qt qml plugin for iOS (static plugin)

    1. Plugin Pro file like flow:
      TEMPLATE = lib
      TARGET = iostestqmlplugin
      QT += qml quick
      CONFIG += qt plugin c++11 static
      uri = IosQmlPluginTest # module name
      QMAKE_MOC_OPTIONS += -Muri=$$uri # static plugin must use this

    2.qmldir file
    module IosQmlPluginTest
    plugin iostestqmlplugin
    typeinfo plugins.qmltypes #static plugin required
    classname IosqmlpluginPlugin # static plugin must set classname for plugin c++ class

    TimeLabel 1.0 qrc:/TimeLabel.qml # your self qml document

    3.qrc file must contains qmldir file, Qt default put qmldir in qrc file with prefix likes: “/qt-project.org/imports/your-plugin-modele-name”, You can special yourself prefix but must endwiths “your-plugin-module-name” and in main cpp need add addImportPath(eg: engine.addImportPath(“qrc:/your-self-prefix-not-contains-your-plugin-module-name”))

    4.put plugins.qmltypes, qmldir and plugin library files together into where Qt install dir’s sub fold name qml($$[QT_INSTALL_QML] Qt default serach path), maybe you can special yourself path in your app pro file by variable QMLPATHS(QMLPATHS += /your/plugin/path)

    1. Init the plugin resources(contains qmldir) at plugin c++ class construction function like:Q_INIT_RESOURCE(your-qrc-file-name);

    6.pulugins.qmltypes file it’s required. can gernerate by qmlplugindup tool.

    7.refrence QtWebView plugin project from Qt source

    usually error:
    1.static plugin for module “QtQuick” with name “your-module-name” has no metadata URI
    fix by add in pro file:QMAKE_MOC_OPTIONS += -Muri=$$URI #URI = your-module-name
    thanks from:https://github.com/wang-bin/QtAV/issues/368

    2.Plugin “your-module-name” is missing a classname entry
    fix by add in qmldir file: classname your-plugin—c++-name
    Reference http://doc.qt.io/qt-5.6/qtqml-modules-qmldir.html

    1. module “your-plugin-module-name” is not installed
      fix by: Qmldir file must in plugin qrc file, plugins.qmltypes need in the plugin dir and special in qmldir

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.