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. Unable to run the "QML Recorder Example" demo on Mac
Forum Updated to NodeBB v4.3 + New Features

Unable to run the "QML Recorder Example" demo on Mac

Scheduled Pinned Locked Moved Solved QML and Qt Quick
13 Posts 3 Posters 952 Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Did you get a request to allow the use of the microphone ?
    Usually you would need to add an entry to your application .plist file that explains why your users shall grant that privilege.

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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      robertwilliamallen
      wrote on last edited by
      #3

      Hi @SGaist , I was not prompted to allow microphone access. I also don't see a .plist file in the directory. I am able to run the widgets "Camera Example" and that one does prompt for microphone and does include a .plist file.

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

        Then for the test, I would grab the .plist from that example and copy it to the app bundle of the other one.

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

        1 Reply Last reply
        0
        • R Offline
          R Offline
          robertwilliamallen
          wrote on last edited by
          #5

          I don't think that will work. I'm noticing with the "Camera Example" it has a .pro file which I believe is coming from qmake. While the "QML Recorder Example" has a CMakeLists.txt file, so it was built with CMake. So, I don't think I can add the "shared" folder to a CMake project. Does that make sense?

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

            MACOSX_BUNDLE_INFO_PLIST but I would copy and adapt the other plist file to match the application.

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

            1 Reply Last reply
            0
            • R Offline
              R Offline
              robertwilliamallen
              wrote on last edited by
              #7

              Okay, I added this to the CMake config:

              Screen Shot 2022-08-01 at 3.13.23 PM.png

              And I am referencing a .plist file with this content:

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
              <plist version="1.0">
              <dict>
                      <key>CFBundleInfoDictionaryVersion</key>
                      <string>6.0</string>
                      <key>CFBundlePackageType</key>
                      <string>APPL</string>
              
                      <key>CFBundleName</key>
                      <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
                      <key>CFBundleIdentifier</key>
                      <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
                      <key>CFBundleExecutable</key>
                      <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
              
                      <key>CFBundleVersion</key>
                      <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
                      <key>CFBundleShortVersionString</key>
                      <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
                      <key>CFBundleLongVersionString</key>
                      <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
              
                      <key>LSMinimumSystemVersion</key>
                      <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
              
                      <key>CFBundleGetInfoString</key>
                      <string>${MACOSX_BUNDLE_INFO_STRING}</string>
                      <key>NSHumanReadableCopyright</key>
                      <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
              
                      <key>CFBundleIconFile</key>
                      <string>${MACOSX_BUNDLE_ICON_FILE}</string>
              
                      <key>CFBundleDevelopmentRegion</key>
                      <string>English</string>
              
                      <key>NSCameraUsageDescription</key>
                      <string>Qt Multimedia Example</string>
                      <key>NSMicrophoneUsageDescription</key>
                      <string>Qt Multimedia Example</string>
                      <key>com.apple.security.device.audio-input</key>
                      <string>Qt Multimedia Example</string>
              
                      <key>NSSupportsAutomaticGraphicsSwitching</key>
                      <true/>
              </dict>
              </plist>
              

              Now when I run in debug mode I am seeing:

              2022-08-01 15:14:42.879870-0500 recorder[12848:436078] User has denied access to microphone
              2022-08-01 15:14:42.879901-0500 recorder[12848:436078] User has denied access to camera
              

              But I never see any prompts for camera or microphone.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                robertwilliamallen
                wrote on last edited by
                #8

                My bad, the full .plist content was cut off. Here's the relevant part:

                        <key>NSCameraUsageDescription</key>
                        <string>Qt Multimedia Example</string>
                        <key>NSMicrophoneUsageDescription</key>
                        <string>Qt Multimedia Example</string>
                        <key>com.apple.security.device.audio-input</key>
                        <string>Qt Multimedia Example</string>
                
                D 1 Reply Last reply
                0
                • R robertwilliamallen

                  My bad, the full .plist content was cut off. Here's the relevant part:

                          <key>NSCameraUsageDescription</key>
                          <string>Qt Multimedia Example</string>
                          <key>NSMicrophoneUsageDescription</key>
                          <string>Qt Multimedia Example</string>
                          <key>com.apple.security.device.audio-input</key>
                          <string>Qt Multimedia Example</string>
                  
                  D Offline
                  D Offline
                  DerReisende
                  wrote on last edited by
                  #9

                  @robertwilliamallen do you have com.apple.security.device.audio-input entitlement in your binary?

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    robertwilliamallen
                    wrote on last edited by
                    #10

                    @DerReisende I'm new to Qt so I don't know if I do or not. How would I check?

                    D 1 Reply Last reply
                    0
                    • R robertwilliamallen

                      @DerReisende I'm new to Qt so I don't know if I do or not. How would I check?

                      D Offline
                      D Offline
                      DerReisende
                      wrote on last edited by
                      #11

                      @robertwilliamallen macOS got really bad when it comes to code signing and all that entitlement stuff, especially if you use the modern Apple Silicon CPU Macs. I couldn‘t really figure out how to do that stuff without help.
                      First you should use the Xcode generator for CMake, then use the latest CMake version you can get.
                      Then you could specify in your CMakeLists.txt something like the following:

                      set_target_properties(MyApp PROPERTIES    XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_LIST_DIR}/MyApp.entitlements )
                      

                      You should read the Apple Documentation regarding Hardened Runtime and Entitlements, e.g. here.
                      You could also create a dummy xcode swift app and look for a tutorial about entitlements and create a proper file in there and copy that to your qt app.

                      One thing that REALLY helped me a lot getting a working Qt mac app done on my system was the following book I bought: Professional CMake. Chapter 23 „Apple Features“ has been really helpful. The above code snippet is part of the book.

                      BTW I just saw in your screenshot that you got a SecTaskLoadEntitlement error so I would guess I am not too far of with my entitlements guess.

                      R 1 Reply Last reply
                      1
                      • D DerReisende

                        @robertwilliamallen macOS got really bad when it comes to code signing and all that entitlement stuff, especially if you use the modern Apple Silicon CPU Macs. I couldn‘t really figure out how to do that stuff without help.
                        First you should use the Xcode generator for CMake, then use the latest CMake version you can get.
                        Then you could specify in your CMakeLists.txt something like the following:

                        set_target_properties(MyApp PROPERTIES    XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_LIST_DIR}/MyApp.entitlements )
                        

                        You should read the Apple Documentation regarding Hardened Runtime and Entitlements, e.g. here.
                        You could also create a dummy xcode swift app and look for a tutorial about entitlements and create a proper file in there and copy that to your qt app.

                        One thing that REALLY helped me a lot getting a working Qt mac app done on my system was the following book I bought: Professional CMake. Chapter 23 „Apple Features“ has been really helpful. The above code snippet is part of the book.

                        BTW I just saw in your screenshot that you got a SecTaskLoadEntitlement error so I would guess I am not too far of with my entitlements guess.

                        R Offline
                        R Offline
                        robertwilliamallen
                        wrote on last edited by
                        #12

                        @DerReisende Thanks so much for the help. I will try your suggestions.

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          robertwilliamallen
                          wrote on last edited by
                          #13

                          Well, it looks like if I click "Run in terminal" it runs correctly as per this:
                          https://bugreports.qt.io/browse/QTCREATORBUG-23880

                          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