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. QML Camera crash on iOS 11.

QML Camera crash on iOS 11.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 3 Posters 916 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.
  • V Offline
    V Offline
    vudangkhoa2906
    wrote on last edited by
    #1

    in my current app (qt 5.9), i use the Camera component as describe in https://doc.qt.io/qt-5/qml-qtmultimedia-cameracapture.html. However the app crash whenever I reach the page that includes this component. The thing is when I comment out the Camera component, my app doesn't crash (but of course, it does not take photos either). But everything works fine with iOS12. Have any faced the same problem? And could you show me how to fix it?

    J.HilkJ 1 Reply Last reply
    1
    • V vudangkhoa2906

      in my current app (qt 5.9), i use the Camera component as describe in https://doc.qt.io/qt-5/qml-qtmultimedia-cameracapture.html. However the app crash whenever I reach the page that includes this component. The thing is when I comment out the Camera component, my app doesn't crash (but of course, it does not take photos either). But everything works fine with iOS12. Have any faced the same problem? And could you show me how to fix it?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @vudangkhoa2906

      hi and welcome,
      a basic question first. Did you add the camera permission to your info.pro info.plist file?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      V 1 Reply Last reply
      0
      • V Offline
        V Offline
        vudangkhoa2906
        wrote on last edited by
        #3

        hi @J-Hilk
        I have the camera mission in my Info.plist file. However, I'm not aware of the info.pro file? Did you mean my Project.pro file?
        And right before moving to the screen that contain the component, I double check the camera permission (as discussed in https://stackoverflow.com/questions/20464631/detect-permission-of-camera-in-ios). And indeed I do have the camera access permission. But the app just keep crashing

        1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @vudangkhoa2906

          hi and welcome,
          a basic question first. Did you add the camera permission to your info.pro info.plist file?

          V Offline
          V Offline
          vudangkhoa2906
          wrote on last edited by
          #4

          @J.Hilk
          oh and one more thing.
          I include the whole Item (as in https://doc.qt.io/qt-5/qml-qtmultimedia-cameracapture.html). But when I remove the Camera element from the Item, the app doesn't crash.

          1 Reply Last reply
          0
          • J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            I'm sorry, I miswrote that one, I meant the info.plist

            You said you checked that, usually the permission popup than comes automatically (on iOS)

            2 more questions:

            • did you add QT += multimedia to your pro file?
            • But everything works fine with iOS12. -- What does that mean exactly ? Your code works in iOS12 but not in other versions ?

            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vudangkhoa2906
              wrote on last edited by
              #6

              I did add Qt += multimedia in my .pro file
              And yes, the code works well with iOS 12.
              I forgot to mention, the code works when i test with my real device.
              However, since I don't have an iOS 11 phone, with the iOS 11 case, I have to test with a simulator. And I have not tested with lower version.
              Do you think maybe the Camera QML element does not work with simulators?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                On recent version of iOS you have to add the NSCameraUsageDescription` entry to your Info.plist file. While it was optional earlier, it's not the case anymore and the OS will make your application will crash if it's missing.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                V 1 Reply Last reply
                0
                • SGaistS SGaist

                  Hi,

                  On recent version of iOS you have to add the NSCameraUsageDescription` entry to your Info.plist file. While it was optional earlier, it's not the case anymore and the OS will make your application will crash if it's missing.

                  V Offline
                  V Offline
                  vudangkhoa2906
                  wrote on last edited by
                  #8

                  hi @SGaist
                  I did add that to my Info.plist file. And in the app, I even ask for user permission to access camera before proceeding to the page that include the Camera. It does indeed work fine with iOS 12 devices, but does not so with simulators :( I need to verify if the app still works with older iOS versions

                  J.HilkJ 1 Reply Last reply
                  0
                  • V vudangkhoa2906

                    hi @SGaist
                    I did add that to my Info.plist file. And in the app, I even ask for user permission to access camera before proceeding to the page that include the Camera. It does indeed work fine with iOS 12 devices, but does not so with simulators :( I need to verify if the app still works with older iOS versions

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @vudangkhoa2906 I'm not sure the simulator actually supports the camera.

                    I know for example, that it doesn't forward the Bluetooth module - at least out of the box, haven't looked into it much.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    2
                    • V Offline
                      V Offline
                      vudangkhoa2906
                      wrote on last edited by
                      #10

                      Yes, now that I have tried to build and run a simple example that comes with Qt itself, the example did indeed work with my real device, but not with simulators.

                      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