Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Problem with iOS app and QML Plugin.
QtWS25 Last Chance

[SOLVED] Problem with iOS app and QML Plugin.

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 1 Posters 95.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • shavS Offline
    shavS Offline
    shav
    wrote on last edited by
    #1

    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!

    Mac OS and iOS Developer

    1 Reply Last reply
    1
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      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?

      Mac OS and iOS Developer

      1 Reply Last reply
      0
      • shavS Offline
        shavS Offline
        shav
        wrote on last edited by
        #3

        Hi, everyone!

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

        Mac OS and iOS Developer

        1 Reply Last reply
        0
        • shavS Offline
          shavS Offline
          shav
          wrote on last edited by shav
          #4

          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
          }
          

          Mac OS and iOS Developer

          1 Reply Last reply
          3

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved