qt webengine request camera and mic access on mac - macos

I tried to access the camera and mic using QWebEngineView so I used this code to grand the access on my Mac
I used the solution which is Here it worked fine when I run the app inside QT and it asks me for the first time on my Mac that QT need to access my Mic and Camera which I allow it and it works, the problem is when I use the release version which has all the needed dependencies and stuff, the app crashes and when I check my system preferences for the permission I did not see the app is listed only QT in both Camer and Mic, and I can't add an app manually.
So what is the solution of this problem? to let the app ask for permission instead of crashes? what edit do I need to do to the codes to allow the app to ask for permission as QT does?
Update
What I tried as well is to run the app from executable inside the .app or the package which allow the terminal to request permission to the camera and mic and I worked but this not effective solution to ask the user to do so.
Another test I did is to go to the info.plist inside the .app package and add both
Privacy - Camra Usage Description
Privacy - Microphone Usage Description
after that I test again, the app not crash but the Camera open and then after 1 or two seconds the Camera close that is it, so I think I need to show the Permission dialog box, any help with it or how to show it up?

after trying many solutions what is worked that I added both permissions to the plist in qt bundle
Privacy - Camra Usage Description
Privacy - Microphone Usage Description
but with values 6.0 or any other value that not have space or long characters, and it worked! and it shows me the permission box and added the app to the privacy in system preferences, maybe long text not let the dialog box show, I am not sure exactly.

Related

Automator takes screenshot of background instead of window

System specs: mac OS Monterrey V12.5, Apple M1 chip 2020
I am making an application which will take a screenshot of a video, and take the timestamp of the current point in this video, after which both the timestamp and screenshot will be send to a numbers file (mac OS excel like program).
I could not find an application to do this and I tried to get it working using python as shown here but was unable to. Now because I am on Mac I have decided to use Automator instead. I am currently on the screenshot part and Automator has a build in screenshot functionality.
Unfortunately, this screenshot does not detect browser or application windows, it will only take a screenshot of my background.
I have no idea why this is but I suspect it might have to do with permissions related to the M1 chip.
I tried different monitors and simplyfying the automation to just taking a screenshot, but so far nothing has helped, I could not find others online who had a similar problem.
If there is any information missing from this post I will be happy to provide it.
Edit: It seems to be some kind of permission issue, automator CAN take screenshots within Safari, now I just need to find a way to do so in firefox.
I have solved the issue, it turns out that the M1 chip has a special permission for screen recording, adding my Automator application to this permission list will allow it to take screenshots of all windows.

How can I add files to the iOS simulator in a CI environment?

I would like to include a UI test in my project that exercises its interaction with UIDocumentPickerViewController. The test will need to run on a CI machine, which needs to be able to wipe the simulator before each build, and operate without a human driving the GUI (either on the machine or the simulator).
There are a number of answered questions around how to add files to the iOS simulator, but they seem to all require manual interaction with the simulator UI. What I've tried so far:
Using xcrun simctl openurl file:///path/to/my%20file.pdf, but that just presents a sheet in the files app that would need manual intervention to actually save to the simulator.
Using xcrun simctl addmedia, but the media need to be images or videos and they end up in PHPickerViewController and not UIDocumentPickerViewController.
Using the openurl command above before the test kicks off and then adding a button in my app to open the shareddocuments:// URL to present the Files app, and using the UI test runner to click the "On My Phone" and "Save" buttons. This looks promising but also promises to be flaky.
What I haven't tried yet:
Set up a sockpuppet iCloud account and log the simulator into that account on every test run in order to use iCloud Drive. This seems like yet another credential to manage that will randomly break when it needs to agree to some new terms and conditions.
Replace my test app with a document-based app and figure out how to save a file from the bundle to its file storage without manual interaction. I'd love a guide on how to do this but it feels like I could easily spend a week getting up to speed on document-based apps to get it working.
The code I'm testing is a framework, so the app under test is free to have features that would make no sense to an actual user and is also free to do non-app-store-safe things. But it seems like other developers might appreciate a more general solution if you have one.

Unity Crash on MacOS when the join method is invoked (Agora.io)

I downloaded the agora.io video sdk asset from the asset store, imported it to a new project. On the demo "SceneHome" scene, I entered the api id. Clicked play, and as soon as I click the "join" button Unity crashes. As far as I can tell the crash happens on the
app.join(field.text);
line in the TestHome.cs script (line #86).
I tested it in 2019.3.2f1 and 2020.1.0b5. The result was the same.
The OS is Catalina 10.15.4.
The demo works on Windows.
I followed this tutorial: https://medium.com/#jake_agora.io/mac-run-video-chat-within-your-unity-application-e001091db62f but used x86_64 dlls instead of x86
Does anyone know what this is about? Or where should I begin to look?
Another tutorial, this one from Agora:
https://www.agora.io/en/blog/run-video-chat-within-your-unity-application-mac
It can be caused by missing the Camera and Microphone usage in the Unity Editor project setting. Please let us know if that's the case. (I saw you are also on the Slack channel, let's continue the conversation there.).
For the people who didn't know, Agora Developer Community - Unity Chat channel is here :)
As herve nau pointed out the problem was that the Unity did not had the permission to use camera or microphone. And the solution should work. Alternatively, here is another way to add the permission as described by launzone:
1) Disable SIP: Go into recovery mode (hold CMD+R when you
restart your Mac) Don't be afraid, we are not doing anything crazy.
2) After that open Terminal (it should be accessible from one of the
Menus at the Top) Type in "csrutil disable" and hit enter. Then reboot
your Mac normally.
3) Open Terminal and type in: "sqlite3 ~/Library/Application\
Support/com.apple.TCC/TCC.db" and hit enter
4) For microphone access, type in: "INSERT INTO access
VALUES('kTCCServiceMicrophone','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
For camera, type in: "INSERT INTO access
VALUES('kTCCServiceCamera','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
6) check in your SystemPreferences/Security&Privacy > unity hub should
now show up in both mic and cam
7) reboot in recovery mode again (CMD+R), open terminal again, type
in: "csrutil enable" and hit enter, to enable SIP again
8) reboot normally and enjoy!
Here is the full thread. I hope it helps someone :)
check if not related to the webcam registration issue on macOs with the Unity Hub running. Fix for the camera, not sure if related to your problem: Remove the Unity Hub app, then open the project directly from Unity App. May also be useful to relocate the Unity app in another folder to force the webcam usage security registration.
Made the test here, Unity 2019.3.11.f1, using the demo app, with Hub active -> crash on press of Join Button, did the Hub removal described above, rerun the same demo and no more crash at this level. Running on Catalina 10.15.2.

How to bypass “Adobe Flash Player has stopped a potentially unsafe operation.” running on Mac 10.7 with local files

I am tearing my hair out. I have a complicated Flash player application which I want to run on my local Mac, 10.7.4. I set this up a year or so ago on earlier Mac OS, with earlier Flash players, and sometimes I had to fiddle with global settings, etc, but it always worked. But now flash has decided (sensibly) to handle the security settings surrounding this use of Flash from the local System Preferences. Here's the appropriate screen which should let me tell Flash that I am opening files in the folder:
You can see my desperate attempts to get flash to let me open files in /Users/peter/BTDE2/ etc -- all failing.
Why? How do I get around this? or do I just give up on flash as a horrible bad job...
It appears from the documentation at http://help.adobe.com/en_US/FlashPlayer/LSM/WS6aa5ec234ff3f285139dc56112e3786b68c-7ff0.html#WS6aa5ec234ff3f285139dc56112e3786b68c-7feb that there should be a fix. According to this, there should be a 'Developer Tools' control on the 'Advanced' panel, which gives access to 'Trusted Location' settings. Well, here is the Advanced panel in Flash System Preferences and it shows no such choices. Looks like someone screwed up somewhere.
In the Flash Player panel are you not able to scroll down to reveal the Developer Tools?

Can Mac app store apps access local file system?

I am wondering what limitations are imposed on the Mac app store. Can someone point me in the right direction? For instance, lets say I wanted to write an app that does incremental auto-backups of files on the Mac file system, is that possible with an app in the Mac app store, or would my only option be a standalone mac app?
On the iPhone, apps are self contained in their own "sandbox"? Does this same principal apply to mac app store apps?
Fellows, what the OP is really referring to is described here:
http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
It is all about
Containers
Entitlements
PowerBox (daemon)
Once an application is "sandboxed" its view of the ~ "home" directory is that of a Container (which happens to be created upon first start in $HOME/Library/Containers/appBundleID/Data). Therein it finds its "private copy" of config, cache and data files. And off course it can't read anything else, unless...
... you give the application the appropriate Entitlements in the form of a codesign-ed property file (in fact, codesigning is integral part of the sandboxing concept).
One of these Entitlements is the "com.apple.security.files.user-selected.read-write" which allows the application to read and write exactly those files which the user has explicitly chosen via the standard save and open dialog respectively.
The PowerBox (pboxd) daemon then renders the appropriate file dialog in its own process space and adds the selected file paths to the list of allowed files. This is transparent to the application, that is no code changes are required - as long as the application uses the standard NSOpenPanel or NSSavePanel dialogs.
"To facilitate application sandboxing, Mac OS X v10.7 provides a trusted system daemon that is tasked with presenting open and save panels on behalf of applications running in an application sandbox. That daemon is called Powerbox (its process name is pboxd). These Powerbox-presented remote panels appear fully indistinguishable from in-process panels in terms of user experience.
Any time an application running inside a sandbox invokes an NSOpenPanel or NSSavePanel dialog, rather than showing the panels directly, AppKit automatically asks the Powerbox to present the dialog. From a developer perspective, there are no code changes required in terms of how these panels are used; this process is fully transparent." [end quote from Apple docs]
Given all that, what the OP would need (for a backup solution) are "unmediated read/writes":
"If an application chooses to derive the user's home directory in a way that bypasses Cocoa APIs (by directly invoking getpwent, for example), the application sandbox prohibits it from writing to the paths it receives (unless the application has the unmediated write entitlement, which is strongly discouraged for obvious security reasons." [end quote from Apple docs]
However the closest Entitlements which would give "free access to the file system" I could fine would be:
"
Absolute file read-only—The ability to read the files or directories at the specified absolute paths. (com.apple.security.temporary-exception.files.absolute-path.read-only)
Absolute file read/write—The ability to read or write the files or directories at the specified absolute paths. (com.apple.security.temporary-exception.files.absolute-path.read-write)
" [end quote from Apple docs]
And I am not sure whether an application could simply provide the root directory "/"
Anyway, carefully note that these entitlements are marked "temporary": Apple might remove/deprecate those entitlements at seen fit!
I believe that starting in November, Mac App Store submissions must adopt the App Sandbox. There are specific entitlements that you can request when your app is submitted to the app store, along with an explanation of why you need those entitlements. More information can be found in WWDC Session 204 video on the Developer site.
Technically, there is sandboxing on the OS X. However, applicants started manually by the user bypass those sandboxing restrictions (sometimes requiring escalation / admin verification screens).
Take a look at:
http://techjournal.318.com/security/a-brief-introduction-to-mac-os-x-sandbox-technology/
The are changing or have changed with the Lion release. Mac Store apps used to be able to do anything within the filesystem that the logged in user privs could allow but I think you are now required to use the entitlements system and hence sandbox your App.
Read this for more ideas
https://developer.apple.com/library/mac/#releasenotes/General/SubmittingToMacAppStore/_index.html#//apple_ref/doc/uid/TP40010572
This will help. Take a good look at it.
http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16
You can currently find Hype or Pixelmator on the Mac App Store.
This proves evidently that you can save to disk and read from disk, which seems a basic feature of any serious application. Moreover, Apple is pushing developers to start using incremental auto-backups of files, it would therefore be very surprising if they forbade that in the App Store, wouldn't it?

Resources