Screencapture sandox error

Calling /usr/sbin/screencapture from my sandboxed app (using NSTask) is generating a sandox violation error and I get an error as result.


com.apple.sandbox.reporting Category: violation

screencapture(3428) deny mach-register com.apple.screencapture.interactive

Violation: deny mach-register com.apple.screencapture.interactive

Process: screencapture [3428]

Path: /usr/sbin/screencapture

Load Address: 0x10154a000

Identifier: screencapture


On versions before Sierra this was working without any problems. There are changes regarding sandox in 10.12? Didn't find anything related.

Dealing with the same painful issue.


If something comes up, please post the way to get it working here.

experiencing the same issue with my app ScreenFloat.


Any suggestions?

After some trying around, I got it working. However, it needs an undocumented temporary entitlement to work:


<key>com.apple.security.temporary-exception.mach-register.global-name</key>

<array>

<string>com.apple.screencapture.interactive</string>

</array>


Suddenly, it works again. I guess I'm filing a rdar.

rdar filed: 27610157

I just realized that this sandbox violation only occurs for interactive screencaptures, i.e.:


screencapture -i /path/to/file.png


If the screencapture is set up non-interactively (without the -i argument), it will work just fine. So I do believe this is a bug in macOS Sierra.

I have updated the bug report accordingly (rdar://27610157)


Regards,

- Matt

The issue persists in macOS Sierra beta 4 (10.12 (16A270f ))

@m.gansrigler: That's right, adding this is fixing the issue:

<key>com.apple.security.temporary-exception.mach-register.global-name</key>
<string>com.apple.screencapture.interactive</string>

But we cannot upload a new build on iTunes Connect with it:

ERROR ITMS-90285: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on Mac OS X. Specifically, key 'com.apple.security.temporary-exception.mach-register.global-name' in '...' is not supported.", did you had any luck?

Facing the same problem. Anxious for an app store compatible workaround.

no luck either, not from El Capitan, nor from macOS Sierra

Using `com.apple.security.temporary-exception.mach-register.global-name` with a value of `com.apple.screencapture.interactive` now passes validation. Note that there isn't an option for this key in the iTunes Connect interface yet.

I can confirm that submitting with said entitlement works now.

I just came across this bug in my own app, thanks all to diagnosing the issue and writing about it. Helped a ton.

Screencapture sandox error
 
 
Q