[SOLVED] Problem with iOS app and QML Plugin.



  • Hi everyone!

    I have a project with QML plugin. On desktop all works fine but when I try to build my application to iOS i've received this error:
    @
    Starting remote process.
    QML debugging is enabled. Only use this in a safe environment.
    QQmlApplicationEngine failed to load component
    qrc:/qml/ios/main.qml:1 static plugin for module "QtQuick" with name "PicfectionSDKPlugin" has no metadata URI
    @

    My qmldir file looks like:
    @
    module com.shav.picfection
    plugin PicfectionSDK
    typeinfo Picfection.qmltypes
    classname PicfectionSDKPlugin
    @

    My plugin was copied to:
    @
    <Qt_install_path>/ios/qml/com/shav/picfection
    @

    What I do wrong? Thanks for any help!



  • Hi everyone!

    I still have problem with QtQuick Plugin on iOS. I've tried research but can't find any solution for this problem. Also I've tried examples but no lucky. Main class of my plugin looks like this:
    @
    class PicfectionSDKPlugin : public QQmlExtensionPlugin
    {
    Q_OBJECT

        Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
    
    public:
        void registerTypes(const char *uri);
    

    };
    @

    Project file of my plugin looks like:
    @
    TEMPLATE = lib
    TARGET = PicfectionSDK
    QT += qml quick network
    ios {
    CONFIG += qt plugin c++11 static
    }
    else
    {
    CONFIG += qt plugin c++11
    }

    TARGET = $$qtLibraryTarget($$TARGET)
    uri = com.shav.picfection

    DESTDIR = com/shav/picfection
    OBJECTS_DIR = tmp/objects
    MOC_DIR = tmp/mocs

    Input

    SOURCES +=
    picfectionsdk_plugin.cpp
    picfectionmanager.cpp
    Requests/picfectionnetworkmanager.cpp
    Requests/picfectionrequest.cpp
    Objects/Team/picfectionteam.cpp
    Objects/Project/picfectionproject.cpp
    Objects/Event/picfectionevent.cpp
    Objects/Event/picfectioneventdatas.cpp
    Objects/Event/picfectioneventdocument.cpp
    Objects/Event/picfectioneventuser.cpp

    HEADERS +=
    picfectionsdk_plugin.h
    picfectionmanager.h
    Requests/picfectionnetworkmanager.h
    Requests/picfectionrequest.h
    Objects/Team/picfectionteam.h
    Objects/Project/picfectionproject.h
    Objects/Event/picfectionevent.h
    Objects/Event/picfectioneventdatas.h
    Objects/Event/picfectioneventdocument.h
    Objects/Event/picfectioneventuser.h

    DISTFILES = qmldir
    picfectionsdk.json

    !equals(PRO_FILE_PWD, $$OUT_PWD) {
    copy_qmldir.target = $$OUT_PWD/$$DESTDIR/qmldir
    copy_qmldir.depends = $$PRO_FILE_PWD/qmldir
    copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"

    sourceQmlTypePath = $$_PRO_FILE_PWD_/Picfection.qmltypes
    targetQmlTypePath = $$OUT_PWD/$$DESTDIR/Picfection.qmltypes
    copy_qmldir.commands += && $(COPY_FILE) \"$$replace(sourceQmlTypePath, /, $$QMAKE_DIR_SEP)\" \"$$replace(targetQmlTypePath, /, $$QMAKE_DIR_SEP)\"
    

    sourceQmlFilesPath = $$PRO_FILE_PWD/MslQmlControllerItem.qml

    targetQmlFilesPath = $$OUT_PWD/$$DESTDIR/MslQmlControllerItem.qml

    copy_qmldir.commands += && $(COPY_FILE) "$$replace(sourceQmlFilesPath, /, $$QMAKE_DIR_SEP)" "$$replace(targetQmlFilesPath, /, $$QMAKE_DIR_SEP)"

    QMAKE_EXTRA_TARGETS += copy_qmldir
    PRE_TARGETDEPS += $$copy_qmldir.target
    

    }

    qmldir.files = qmldir
    unix {
    installPath = $$[QT_INSTALL_QML]/$$replace(uri, \., /)
    qmldir.path = $$installPath
    target.path = $$installPath
    INSTALLS += target qmldir
    }
    @

    And application pro file looks like:
    @
    TEMPLATE = app

    QT += qml quick widgets

    SOURCES += main.cpp

    macx {

    ICON = icon_512x512.icns

    QMAKE_INFO_PLIST = Info.plist
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    

    }
    else:ios {

    ICON = icon_512x512.icns

    QMAKE_INFO_PLIST = Info_ios.plist
    RESOURCES += qml_ios.qrc
    
    QTPLUGIN += PicfectionSDK
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    

    }

    CODECFORTR = UTF-8

    Default rules for deployment.

    include(deployment.pri)
    @

    I can't understand how to fix problem with metadata URI. Could you help me with this?



  • Hi, everyone!

    Maybe somebody know where I can find information about metadata URI for iOS QML plugins?



  • Hi everyone!

    At last I found the solution of my problem with static plugin for iOS. The solution is: set line to your plugin .pro file
    @
    QMAKE_MOC_OPTIONS += -Muri=com.shav.picfection
    @

    and you plugin .pro file must looks like:

    TEMPLATE = lib
    TARGET = PicfectionSDK
    QT += qml quick network
    ios {
    	CONFIG += qt plugin c++11 static
    }
    else
    {
    	CONFIG += qt plugin c++11
    }
    
    TARGET = $qtLibraryTarget($TARGET)
    uri = com.shav.picfection
    QMAKE_MOC_OPTIONS += -Muri=com.shav.picfection #<----- This helped me to solve my problem.
    
    DESTDIR = com/shav/picfection
    OBJECTS_DIR = tmp/objects
    MOC_DIR = tmp/mocs
    
    SOURCES += 
    	picfectionsdk_plugin.cpp 
    	picfectionmanager.cpp 
    	Requests/picfectionnetworkmanager.cpp 
    	Requests/picfectionrequest.cpp 
    	Objects/Team/picfectionteam.cpp 
    	Objects/Project/picfectionproject.cpp 
    	Objects/Event/picfectionevent.cpp 
    	Objects/Event/picfectioneventdatas.cpp 
    	Objects/Event/picfectioneventdocument.cpp 
    	Objects/Event/picfectioneventuser.cpp
    
    HEADERS += 
    	picfectionsdk_plugin.h 
    	picfectionmanager.h 
    	Requests/picfectionnetworkmanager.h 
    	Requests/picfectionrequest.h 
    	Objects/Team/picfectionteam.h 
    	Objects/Project/picfectionproject.h 
    	Objects/Event/picfectionevent.h 
    	Objects/Event/picfectioneventdatas.h 
    	Objects/Event/picfectioneventdocument.h 
    	Objects/Event/picfectioneventuser.h
    
    DISTFILES = qmldir 
    picfectionsdk.json
    
    !equals(PRO_FILE_PWD, $OUT_PWD) {
    	copy_qmldir.target = $OUT_PWD/$DESTDIR/qmldir
    	copy_qmldir.depends = $PRO_FILE_PWD/qmldir
    	copy_qmldir.commands = $(COPY_FILE) "$replace(copy_qmldir.depends, /, $QMAKE_DIR_SEP)" "$replace(copy_qmldir.target, /, $QMAKE_DIR_SEP)"
    
    	sourceQmlTypePath = $_PRO_FILE_PWD_/Picfection.qmltypes
    	targetQmlTypePath = $OUT_PWD/$DESTDIR/Picfection.qmltypes
    	copy_qmldir.commands += && $(COPY_FILE) \"$replace(sourceQmlTypePath, /, $QMAKE_DIR_SEP)\" \"$replace(targetQmlTypePath, /, $QMAKE_DIR_SEP)\"
    	sourceQmlFilesPath = $PRO_FILE_PWD/MslQmlControllerItem.qml
    	targetQmlFilesPath = $OUT_PWD/$DESTDIR/MslQmlControllerItem.qml
    	copy_qmldir.commands += && $(COPY_FILE) "$replace(sourceQmlFilesPath, /, $QMAKE_DIR_SEP)" "$replace(targetQmlFilesPath, /, $QMAKE_DIR_SEP)"
    	QMAKE_EXTRA_TARGETS += copy_qmldir
    	PRE_TARGETDEPS += $copy_qmldir.target
    }
    
    qmldir.files = qmldir
    unix {
    	installPath = $[QT_INSTALL_QML]/$replace(uri, \., /)
    	qmldir.path = $installPath
    	target.path = $installPath
    	INSTALLS += target qmldir
    }

Log in to reply
 

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