Table of Contents

Class PermissionsHelper

Namespace
VisioForge.Core.Helpers
Assembly
VisioForge.Core.dll

Cross-platform helper for permissions that are required for media capture.

public static class PermissionsHelper

Inheritance

Inherited Members

Methods

CheckScreenRecordingPermission(BaseContext)

Checks whether the running app has Screen Recording permission on macOS / Mac Catalyst.

public static ScreenRecordingPermissionStatus CheckScreenRecordingPermission(BaseContext context = null)

Parameters

context BaseContext

Returns

ScreenRecordingPermissionStatus

VisioForge.Core.Helpers.ScreenRecordingPermissionStatus.Granted when the app can capture the screen, VisioForge.Core.Helpers.ScreenRecordingPermissionStatus.Denied when the user has not allowed it, or VisioForge.Core.Helpers.ScreenRecordingPermissionStatus.NotApplicable on platforms that do not require this permission.

Remarks

macOS caches the TCC decision per process. If the user grants the permission after the app has already started, the process must be relaunched before CGPreflightScreenCaptureAccess reports true. Without the permission, AVCaptureScreenInput initWithDisplayID: returns nil, which makes AVCaptureSession addInput: throw NSInvalidArgumentException and terminate the process.

RequestScreenRecordingPermission(BaseContext)

Requests Screen Recording permission on macOS / Mac Catalyst. The first call presents the system TCC dialog; subsequent calls return the cached state without reprompting.

public static bool RequestScreenRecordingPermission(BaseContext context = null)

Parameters

context BaseContext

Returns

bool

true if permission is already granted for the current process, false otherwise (the user must relaunch the app after approving in System Settings).

Remarks

The system dialog must be posted from the main thread; this method marshals the call as needed. A false return value immediately after a grant is normal — macOS only reevaluates TCC state at process start. Ask the user to relaunch the app and re-check with VisioForge.Core.Helpers.PermissionsHelper.CheckScreenRecordingPermission(VisioForge.Core.BaseContext).