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/Qt App, Camera, MacOs Mojave, Crash.
QtWS25 Last Chance

QML/Qt App, Camera, MacOs Mojave, Crash.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 1 Posters 832 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.
  • matthew.kuiashM Offline
    matthew.kuiashM Offline
    matthew.kuiash
    wrote on last edited by
    #1

    OK. Weird problem. My application just crashes when I run it "normally" via Qt Creator.

    To clarify. I have added a custom Info.plist that adds the NSCameraUsageDescription key.

    • If I run the app from the CLI e.g. "open qml_camera_test1.app" it will launch fine (on first launch I get the "do you want to let the app use the camera" spiel from MacOs)
    • If I execute $BLAH/build-qml_camera_test1-Desktop_Qt_5_12_0_clang_64bit-Debug/qml_camera_test1.app/Contents/MacOS/qml_camera_test1 on the terminal I get a message that the terminal would like to use the camera (WTF!) but the app still runs fine - although I now fear I've allowed the terminal unfettered access to the camera.
    • If I run the app via Apple+Y e.g. the debugger it runs fine.
    • If I Apple+R e.g. run from Qt Creator my app simply crashes.

    Any ideas please?

    The legendary cellist Pablo Casals was asked why he continued to practice at age 90. "Because I think I'm making progress," he replied.

    1 Reply Last reply
    0
    • matthew.kuiashM Offline
      matthew.kuiashM Offline
      matthew.kuiash
      wrote on last edited by
      #2

      OK. I'm a little closer to sussing this out. What I'm saying here might not be true it's just my investigation.

      Running from the Terminal gave me my clue. When the camera app is launched from Terminal it is a child process of the Terminal. This is why I get a dialogue asking "Do you want to allow Terminal access to the camera".

      Under the debugger ANYTHING goes and I reckon macOS isn't checking a lot of privileges because, well, it's the debugger.

      When launched (Apple+R) from Creator I think the application is a child process of Qt Creator (or possibly the child or a child).

      Qt Creator does not have camera permissions so the OS just shuts down the offending application.

      Onwards and sideways.

      The legendary cellist Pablo Casals was asked why he continued to practice at age 90. "Because I think I'm making progress," he replied.

      1 Reply Last reply
      0
      • matthew.kuiashM Offline
        matthew.kuiashM Offline
        matthew.kuiash
        wrote on last edited by
        #3

        Wow. That took some fiddling.

        • Make sure that Qt Creator has Camera permissions enabled under System Preferences -> Security & Privacy -> Privacy -> Camera
        • Shut down all instances of Qt Creator and then start again - macOS only seems to set these permissions on the app when it starts. The clue here was that when I changed the setting in sys prefs the OS asked me if I wanted to close the app now or later

        That's it. It seems to be working AOK - which has seriously improved my work flow!

        The legendary cellist Pablo Casals was asked why he continued to practice at age 90. "Because I think I'm making progress," he replied.

        1 Reply Last reply
        2

        • Login

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