Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] The deploy version of my app doesn't work



  • Hi everyone!

    I have a problem with create deploy version of my application using 'macdeployqt' tool. If I compile my application without this tool my application is run correct. But If I call command:
    @
    /Volumes/Documents/Applications/Qt/Qt5.3.0/5.3/clang_64/bin/macdeployqt QtForumReader.app -dmg
    @

    I've got this:
    @
    QQmlImportDatabase::addImportPath: "/Volumes/Documents/MyWork/PROJECTS/QtProjects/GIT/QtForumReader/Desktop/1.x/build-QtForumProject-Desktop_Qt_5_3_0_clang_64bit-Release/QtForumReader/QtForumReader.app/Contents/Resources/qml"
    QQmlImportDatabase::addImportPath: "/Volumes/Documents/MyWork/PROJECTS/QtProjects/GIT/QtForumReader/Desktop/1.x/build-QtForumProject-Desktop_Qt_5_3_0_clang_64bit-Release/QtForumReader/QtForumReader.app/Contents/MacOS"
    QQmlImportDatabase::addImportPath: "/Volumes/Documents/MyWork/PROJECTS/QtProjects/GIT/QtForumReader/Desktop/1.x/build-QtForumProject-Desktop_Qt_5_3_0_clang_64bit-Release/QtForumReader/QtForumReader.app/Contents/Plugins"
    QQmlImports(qrc:///qml/main.qml)::addLibraryImport: "com.shav.qtforum" 1.0 as ""
    QQmlImports(qrc:///qml/main.qml)::importExtension: loaded "/Volumes/Documents/MyWork/PROJECTS/QtProjects/GIT/QtForumReader/Desktop/1.x/build-QtForumProject-Desktop_Qt_5_3_0_clang_64bit-Release/QtForumReader/QtForumReader.app/Contents/Plugins/com/shav/qtforum/qmldir"
    QQmlImportDatabase::registerPluginTypes: "com.shav.qtforum" from "/Volumes/Documents/MyWork/PROJECTS/QtProjects/GIT/QtForumReader/Desktop/1.x/build-QtForumProject-Desktop_Qt_5_3_0_clang_64bit-Release/QtForumReader/QtForumReader.app/Contents/Plugins/com/shav/qtforum"
    QQmlApplicationEngine failed to load component
    qrc:///qml/main.qml:3 module "com.shav.qtforum" is not installed
    @

    As you can see my plugin is loaded but QML file can't use it. Could you tell me what I do wrong?

    Thanks for the any help!



  • Hi everyone!

    At last I found the solution of my problem:
    @
    macdeployqt <your_app_name>.app -verbose=1 -qmldir=../../<your_app_src_folder>/qml/ -executable=<your_app_name>.app/Contents/MacOS/<your_app_name>
    @

    This command is generate correct app. But I have a small problem with my QML Plugin. The command is copied the "myApp.app" not the plugin. And I don't understand why. But if I copy it myself it's works correct.
    Also my app is change style for component. How I can set correct style if I don't change it in my code?

    The next step I'll try to use certificates to upload app in App Store.



  • Hi everyone!

    Today I've submitted to Apple my first application with Qt and I want to share my script to create the package which you need to send to App Store for MacOS.
    @
    #create app to use it on mac without Qt
    <Qt_path>/5.3/clang_64/bin/macdeployqt <app_name>.app -verbose=1 -qmldir=<path_to_project_src>/qml/ -executable=<app_name>.app/Contents/MacOS/<app_name>

    #remove not needed folder with plugin
    rm -rf <app_name>.app/Contents/Resources/qml/com

    #copy info plist form frameorks
    cp <Qt_path>/5.3/clang_64/lib/QtQuick.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtQuick.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtQml.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtQml.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtNetwork.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtNetwork.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtGui.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtGui.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtCore.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtCore.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtPrintSupport.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtPrintSupport.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtWidgets.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtWidgets.framework/Resources/
    cp <Qt_path>/5.3/clang_64/lib/QtXml.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtXml.framework/Resources/

    #create dSYM file
    dsymutil <app_name>.app/Contents/MacOS/<app_name> -o <app_name>.app.dSYM

    #sign all *.dylib
    find <app_name>.app/Contents -name *.dylib | xargs -I $ codesign -vvvv --force --verify --deep --verbose --sign "3rd Party Mac Developer Application: Team ID" $

    #sign Qt frameworks
    find <app_name>.app/Contents -name Qt* -type f | xargs -I $ codesign -vvvv --force --verify --deep --verbose --sign "3rd Party Mac Developer Application: Team ID" $

    #sign app
    codesign -vvvv --force --verify --deep --verbose --entitlements Entitlements.plist --sign "3rd Party Mac Developer Application: Team ID" <app_name>.app

    #create product package
    productbuild --component "<app_name>.app" /Applications --sign "3rd Party Mac Developer Installer: Team ID" --product "<app_name>.app/Contents/Info.plist" <app_name>.pkg@

    You can check your app using command:
    @
    codesign -dvvv <app_name>.app
    @

    This command will show you the problem if they are exist.


  • Lifetime Qt Champion

    Hi,

    Thanks for sharing !

    You should rather look if there's already a wiki page about this, if not, please consider creating one. Forum messages tends to get forgotten as time passes by



  • [quote author="SGaist" date="1398109519"]Hi,

    Thanks for sharing !

    You should rather look if there's already a wiki page about this, if not, please consider creating one. Forum messages tends to get forgotten as time passes by[/quote]

    Hi,

    I saw the "wiki page":http://doc-snapshot.qt-project.org/qt5-stable/macosx-deployment.html#macdeploy and this "article":http://blog.qt.digia.com/blog/2012/04/03/how-to-publish-qt-applications-in-the-mac-app-store-2/. But when I tried to use the wiki page I found a problem with steps to prepare the project. So I need many time to understand what I must to do.

    Also on the wiki page has a many information which doesn't help me. I mean the use 'install_name_tool'. Also as I understand the 'macdeployqt' tool must prepared the application to Apple, right? If so this tool don't work correctly. The main issue of 'macdeployqt' is doesn't copy Info.plist files from Qt*.frameworks to frameworks inside application bundle. In my script you can see this:
    @
    #copy info plist form frameworks
    cp <Qt_path>/5.3/clang_64/lib/QtQuick.framework/Contents/Info.plist <app_name>.app/Contents/Frameworks/QtQuick.framework/Resources/
    .....
    @

    I think we need to create the tool which can prepared application to send to Apple App Store. It's can be a script or application. What do you think? I don't know how to do this more effective maybe you can help me?


  • Lifetime Qt Champion

    macdeployqt was originally intended to help distribute Qt application on OS X. At that time the App Store didn't exists so it's not its first purpose. However it can always be improved and that feature added.

    The first thing to do is check the "bug report system":http://bugreports.qt-project.org to see if there's already something about it. If not please open a feature request to track that.



  • Hi everyone!

    There are application to create a package and then send it to Apple. You can download application "here":http://www.dshav.com/my_projects/qt-projects/qt-app-mac-deploy/. Application only for Mac OS X. In DMG file you can find source code.

    [quote author="SGaist" date="1398115999"]The first thing to do is check the "bug report system":http://bugreports.qt-project.org to see if there's already something about it. If not please open a feature request to track that.[/quote]
    I've tried find some task but didn't find tasks with this bug, so I've created a "new":https://bugreports.qt-project.org/browse/QTBUG-38511.


  • Lifetime Qt Champion

    Thanks for sharing the link !


Log in to reply