Deploying QML external module to IOS



  • 'm trying to deploy a QML application to IOS, the problem is that this app depend on a external QML module. I added the module path to the QML2_IMPORT_PATH, and it works fine when I run it in the desktop I'm developing on, the problem happens when I try to deploy to IOS, in that case I keep getting the error message:

    "module ModuleName is not installed"
    I'd this problem before and "solved" it copying the whole module tree to the project directory, but it's not a good solution and I want to understand why this is happening. So, I tried only adding the module directory to the QML project (without copying the files), but the error is still there, I even tried to add it as resource files.

    My guess is that I'm missing some step in the deployment process to be able to deploy the module with my app, but can't find any information regarding this. Any idea?

    Qt version: 5.5 Indie Mobile License

    Qt Creator 3.4.2

    IOS: 8.4



  • Try taking a look here:

    https://forum.qt.io/topic/57284/solved-deploying-a-qt-quick-2-plugin-with-a-static-build

    This is aimed at a static build, but it may be worth checking you're not missing out on any of the required deployment steps.



  • Thanks for the answer Monomix,
    I was trying to understand the steps you followed, the only thing I think maybe can help my case is setting QMAKE_MOC_OPTIONS, but I can't find any documentation about it =/
    Anyway, I'll do some attempts and let you know.

    Another thing (I don't know if related) is that Qt Creator can't provide any tips about my external module (i.e: autocomplete, highlight, etc)



  • Yup, it's not well documented! I stumbled upon the QMAKE_MOC_OPTIONS thing after copious amounts of web trawling.

    The lack of autocomplete is normal, as far as I know. Another thing to note is that if you want to use your extension plugin when prototyping with qmlscene, you need to copy it to the Qt installation directory's qml directory, with a folder structure matching the plugin's URI. So if the URI is my.plugin.uri and your plugin's name is Dave, copy the plugin binary, qmldir file and plugins.qmltypes file to qml/my/plugin/uri/dave.



  • I tried a few values in QMAKE_MOC_OPTIONS, still no success.
    I also tried to copy the whole module structure to my Qt Project, but if I reference it as a module the error still happens.

    No ideia what else I can try, and I'm feeling very frustrated trying to use Qt for mobile development =/

    Here's saying that everything must be static linked for IOS http://doc.qt.io/qt-5/porting-to-ios.html
    And it says specifically about Qt plugins, but no mention to QML modules, and as far as I know, they're not the same thing, right?

    The good news is that I was able to make Qt Creator recognize the module in its code model (for autocomplete/highlight), all I'd to do is set QML_IMPORT_PATH in .pro file



  • If I understand it correctly, a module can be defined purely in QML (QML and qmldir files), or also with additional functionality defined using a C++ plugin - so a C++ plugin is a part of the module, in that sense. What is it you have?



  • I'm using the Papyros one: http://papyros.io/
    Only qml and qmldir files :)

    It has a structure of dirs like that:
    modules/
    --- Material
    --- QtQuick

    I'm import modules into my app to use some Material Components.



  • In that case, a module not installed error probably indicates that the module files aren't being found where the application expects them to be at runtime. With static builds, all QML files have to be deployed with the application - in this case, since the module is only QML and qmldir files, it'd be possible to deploy them using the resource system, rather than copying them to the application directory.



  • I tried to add the files to the resource system.
    Then I followed the answer here: http://www.qtcentre.org/archive/index.php/t-43236.html

    And tried to import like that:
    import "qrc:/modules";
    import Material 0.1;

    No success
    I tried adding only the original files, tried creating a link to the original files, tried the import statement with different sintaxes:
    import "qrc:/modules"; import ":/modules"; import "qrc:/../qml-material/modules"; import ":/modules" as modules;

    Nothing seems to be working, and now not even in the Desktop version if I remove the QML2_IMPORT_PATH env var and relying in the resource system only.
    No idea what else I can try.



  • Finally I could deploy to IOS.

    What I was missing is that I still need to add the directory to the import path, even when it's in the resource system, and as Monomix told I need all the files to be in the resource system.
    Thanks Monomix for all the help



  • Hi, im also struggling to deploy an app with the qml-material plugin to ios. Can you provide a small working example or do you have some blog post detailing all necessary steps?

    Regards!


Log in to reply
 

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