Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0
Forum Updated to NodeBB v4.3 + New Features

Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0

Scheduled Pinned Locked Moved Mobile and Embedded
23 Posts 11 Posters 14.0k Views 2 Watching
  • 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.
  • V Offline
    V Offline
    V-Play-db
    wrote on 4 Nov 2013, 16:30 last edited by
    #9

    Thank you very much Gianluca! This workaround works fabulous!

    Although I had to leave

    @viewer.engine()->setImportPathList(QStringList()); @

    away to compile correctly.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      CuteiOS
      wrote on 4 Nov 2013, 21:25 last edited by
      #10

      You should be using Q_OS_IOS for iOS. The Q_OS_MAC might work for now, but it also includes OSX, and isn't guaranteed to work in the future for iOS.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dbrian
        wrote on 6 Nov 2013, 04:00 last edited by
        #11

        For the people that have successfully tried this workaround...are you deploying to an actual device or the iOS Simulator? For me, this works fine on the device, but when I try to compile for the simulator I get a ton of 'duplicate symbol' linker errors. Seems to be lots of conflicts between Qt5Qml/Qt5Quick and Qt5Declarative. Has anyone else run into this or have suggestions for fixing it?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          V-Play-db
          wrote on 6 Nov 2013, 13:03 last edited by
          #12

          I'm currently only deploying on the devices and not on simulators!

          1 Reply Last reply
          0
          • E Offline
            E Offline
            edmon
            wrote on 6 Nov 2013, 15:30 last edited by
            #13

            @ dbrian: not sure if you are aware, but if you want to run this on the simulator, you'll have to run qmake from Qt 5.2.0 (ios_x86), while if you want to run on an actual device, you need to run qmake from Qt 5.2.0 (ios_armv7) tool chain.

            @Gianluca: Yes that worked perfectly, i was finally able to run a QtQuick2 application.

            Now the bad part is, for some reason it stopped working for any Qt application beginning of this month, I thought my tool chain was broken, so I restored my Mac via "Time Machine" to a point, when the toolchain definitively worked, but no success. I was able to run the app via XCode on the device, and once done, I could start that same app again, but I when I created an IPA using a provisioning profile, the IPA did install on the device, but when started, the only thing was the black screen and then the app stopped. Console log showed exited abnormally with exit status 255. This was with qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-23_08-56-32-110.dmg .
            Weird... the only change I did on Apple side, I had to change/update a provisioning profile. I am still able to successfully deploy and start native iOS apps, so it's not a matter of corrupted provisioning profiles. They just seem to have stopped working with Qt apps...

            So I tried the latest build qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-11-05_13-03-56-133.dmg , now the app deploys correctly and starts up, but now it stalls with a black screen, on the debug output is the message Failed to find shader ":/scenegraph/shaders/opaquetexture.vert" .

            1 Reply Last reply
            0
            • E Offline
              E Offline
              edmon
              wrote on 6 Nov 2013, 16:25 last edited by
              #14

              Ok, got an older version (tested with qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-18_08-24-56-104.dmg), that worked

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dbrian
                wrote on 7 Nov 2013, 06:32 last edited by
                #15

                For what it's worth, here is another workaround I figured out that doesn't require any changes to your .pro file or source code.

                Create a .qml file in the same directory as your .pro file where you declare any qml imports your application requires.

                @
                /*
                imports.qml

                Declaration of QML Imports 
                required by project.
                
                This is necessary if we want 
                to keep qml files in a folder
                separate from .pro file because 
                of the way qmlimportscanner works.
                If these imports are not declared, 
                qmake will not recognize them,
                and QtQuick will not be packaged 
                with statically built apps (i.e. iOS)
                and imported at runtime.
                
                This must be kept in the same 
                directory as your .pro file
                

                */

                import QtQuick 2.1
                import QtQuick.Window 2.1
                //import etc, etc, etc.

                QtObject {}
                @

                I came to this solution because I found that I was able to build/deploy most of the example QtQuick2.0 apps to a device/simulator without any issue, but my own apps were throwing a 'QtQuick not installed' error on deployment. This seemed really strange to me so I dug into the source and found that qmake uses a tool called qmlimportscanner and attempts to locate any qml imports by parsing qml files in the directory of the .pro file for 'import ...' statements. Then qmake automatically sets up the appropriate lib dependencies for static builds. Since I like to keep my .qml files in a separate directory, qmake didn't know I had dependencies on the QtQuick plugins. Putting this file there helps qmake figure out what libraries/plugins it needs to bundle with your app

                Hopefully this helps someone. If you want to look into it yourself, the relevant qmake code is in qt.prf (search for '# static builds: link qml import plugins into the app.').

                K 1 Reply Last reply 2 Jun 2020, 22:00
                1
                • D Offline
                  D Offline
                  devuser
                  wrote on 18 Nov 2013, 14:37 last edited by
                  #16

                  i am having the same issue than edmon. I tried and tried look and look but always the same result. When I run the app with qt creator everithing works perfect but if I try to generate the .IPA file and install the app with iTunes. Always the same result, black screen for few seconds and then closes in the console it says : exited abnormally with exit status 255
                  I tried with several versions and different configurations in XCode, could somebody give me a hint.

                  I really dont know where even keep looking for the info.

                  Thanks

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    edmon
                    wrote on 18 Nov 2013, 15:04 last edited by
                    #17

                    Hi devuser,

                    I found out the for some reason some Qt builds were somehow broken, running on simulator and running on the device through XCode was working fine, but when installed from an IPA, it did not, so I went back and tested for older Qt builds. I found the following builds to be working with IPA installation:

                    • Build 104: qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-18_08-24-56-104.dmg
                    • Build 106: qt-mac-opensource-5.2.0-beta1-ios-x86_64-offline_2013-10-20_13-21-35-106.dmg

                    I foung e.g. Builds 109 and 110 not to be working with IPA deployment. I recently did not have the chance to test for newer builds, as of today it looks like Builds 135 and later are available on the "beta1":http://download.qt-project.org/snapshots/qt/5.2/5.2.0-beta1/ path, and there is also now the "rc1":http://download.qt-project.org/snapshots/qt/5.2/5.2.0-rc1/ path available, you may want to try those.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      devuser
                      wrote on 18 Nov 2013, 15:19 last edited by
                      #18

                      could you tell me the process you follow to get the IPA with one of those please. It is very important for me. I really will be very grateful.

                      Thanks you very much

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        edmon
                        wrote on 18 Nov 2013, 15:45 last edited by
                        #19

                        After installing the Qt5 package, the following toolchains are available:

                        Qt 5.2.0 (ios_x86): use this tool chain if the resulting code is supposed to be tested with XCode's device simulator

                        Qt 5.2.0 (ios_armv7): use this tool chain if the resulting code is supposed to be tested or to be deployed to an actual device

                        Here is the proceeding as I use to generate the IPA:

                        open your Qt project with QtCreator

                        make the adaptions if using QtQuick2 (Gianluca's solution as of October 30, 2013)

                        select the appropriate tool chain for the intended purpose, i.e. for generating simulation or deployment code

                        run qmake from QtCreator's menu. This will create a shadow build for the selected tool chain containing an XCode project file, e.g. MyProject.xcodeproj

                        open that generated XCode project file, this will invoke XCode

                        in the Summary tab in section iOS Application Target, change the Bundle identifier to your need, currently it defaults to com.yourcompany.<appname>. This is imoportant for deployment to match the app with a defined App ID in the Apple Developer Member Center

                        change other app specific settings if needed, e.g. the supported device orientation

                        start compilation from within XCode

                        continue as for a standard (native) iOS application, either run it on simulator, run it on a connected device or deploy it (generate an IPA file)

                        To generate the IPA (the following is valid for XCode 4.6.3):

                        build and archive the code in XCode

                        switch to XCode Organizer into Section "Archives"

                        select the archive you just generated and click on the button "Distribute..."

                        select the intended method of distribution, e.g. "Save for Enterprise or Ad-Hoc Deployment" and click "Next"

                        select the "Code Signing Identity" and click "Next"

                        select a location to store the generated IPA file

                        VoilĂ , there is your IPA file

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          devuser
                          wrote on 18 Nov 2013, 15:50 last edited by
                          #20

                          again thanks very much

                          1 Reply Last reply
                          0
                          • timdayT Offline
                            timdayT Offline
                            timday
                            wrote on 5 Apr 2014, 23:31 last edited by
                            #21

                            For what it's worth, I just ran into this problem out of the blue (despite having previously had QML stuff working on the iPad simulator) after I nuked a build area. (On MacOS 10.8 using the Qt5.2.1 for ios).

                            One thing which had changed in the development area's history: I'd moved the qml files into a subdirectory (relative to the .pro file).

                            I just followed dbrian's advice and created a near identical imports.qml adjacent to the .pro... and ta-da... back in action again.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              dbrian
                              wrote on 1 May 2014, 01:43 last edited by
                              #22

                              Another FWIW: The 'imports.qml' file I mentioned above doesn't seem to be necessary anymore in Qt 5.3. Maybe the build system is now searching deeper in the project hierarchy for import statements.

                              1 Reply Last reply
                              1
                              • D dbrian
                                7 Nov 2013, 06:32

                                For what it's worth, here is another workaround I figured out that doesn't require any changes to your .pro file or source code.

                                Create a .qml file in the same directory as your .pro file where you declare any qml imports your application requires.

                                @
                                /*
                                imports.qml

                                Declaration of QML Imports 
                                required by project.
                                
                                This is necessary if we want 
                                to keep qml files in a folder
                                separate from .pro file because 
                                of the way qmlimportscanner works.
                                If these imports are not declared, 
                                qmake will not recognize them,
                                and QtQuick will not be packaged 
                                with statically built apps (i.e. iOS)
                                and imported at runtime.
                                
                                This must be kept in the same 
                                directory as your .pro file
                                

                                */

                                import QtQuick 2.1
                                import QtQuick.Window 2.1
                                //import etc, etc, etc.

                                QtObject {}
                                @

                                I came to this solution because I found that I was able to build/deploy most of the example QtQuick2.0 apps to a device/simulator without any issue, but my own apps were throwing a 'QtQuick not installed' error on deployment. This seemed really strange to me so I dug into the source and found that qmake uses a tool called qmlimportscanner and attempts to locate any qml imports by parsing qml files in the directory of the .pro file for 'import ...' statements. Then qmake automatically sets up the appropriate lib dependencies for static builds. Since I like to keep my .qml files in a separate directory, qmake didn't know I had dependencies on the QtQuick plugins. Putting this file there helps qmake figure out what libraries/plugins it needs to bundle with your app

                                Hopefully this helps someone. If you want to look into it yourself, the relevant qmake code is in qt.prf (search for '# static builds: link qml import plugins into the app.').

                                K Offline
                                K Offline
                                KH-219Design
                                wrote on 2 Jun 2020, 22:00 last edited by
                                #23

                                @dbrian said in Qt 5.2 beta 1 / iOS / QtQuick 1.1 and 2.0:

                                Create a .qml file in the same directory as your .pro file where you declare any qml imports your application requires

                                Amazing. It is now 2020 (7 years have passed), and this "imports.qml" trick still solved my iOS/qmake issue today. Thanks, from the future ;)

                                www.219design.com
                                Software | Electrical | Mechanical | Product Design

                                1 Reply Last reply
                                0

                                • Login

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