Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unavailable camera device will produce app crash on macOS Mojave #6193

Closed
valillon opened this issue Dec 14, 2018 · 2 comments

Comments

@valillon
Copy link

commented Dec 14, 2018

Related #3425 and #4805.

After launching an app several times, the built-in camera gets blocked and refuses to update the textures. After several trials more it started to refuse being added as input in ofAVFundationGrabber.mm and then it crashes the app.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Can't add a nil AVCaptureInput'

At first I thought it's caused by a wrong camera release since I did not call ofVideoGrabber::close() on exit. But after reboot I'm still not able to make the built-in camera work. Maybe the new security policy in Mojave is more strict on blocking suspicious software trying to access camera and mics.

In this commit I added a couple of console outputs and it avoids to add non-available devices. At least the app does not crash anymore. No textures coming though.

@valillon

This comment has been minimized.

Copy link
Author

commented Dec 14, 2018

Wow very weird stuff.
I went back to Mojave's System Preferences > Security and Privacy > (tab) Privacy.
There were just two OF apps there. I accidentally de-selected one of them because it was so old. After that the camera issue happened but I did not connected the issue with that app because it was a very old app weirdly named Head.temp_caseinsensitive_renameDebug.app, and the current app's name was FaceSimple.app. But surprisingly after re-activating the camera access permission to that old app, the current one got access too.

The commit may be a bit useful anyway.

@ofTheo

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

This is an interesting one. I think the issue is that all OF apps use cc.openframeworks.ofapp as the bundle id.

This is what the privacy system in Mojave is using to ID the app ( apparently ).
I just upgraded to 10.14 and noticed this issue.

A fairly easy fix would be to give each OF app a unique bundle id based on the executable name.
So for myApp1.app we would have cc.openframeworks.myApp1 as the bundle id.

I just did a test and this seemed to fix it:

using:
cc.openFrameworks.${EXECUTABLE_NAME}

in openFrameworks-info.plist

Will PR a fix.
Might need to do the same for iOS

Thanks!

@ofTheo ofTheo closed this in b542807 Aug 7, 2019

ofTheo added a commit that referenced this issue Aug 7, 2019

Merge pull request #6353 from ofTheo/bugfix-mojave-permissions
bugfix for mojave permissions issues with camera. closes #6193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.