Instance Method

requestAuthorizationOfType:completionHandler:

Requests authorization to perform a privileged file operation.

Declaration

- (void)requestAuthorizationOfType:(NSWorkspaceAuthorizationType)type completionHandler:(void (^)(NSWorkspaceAuthorization *authorization, NSError *error))completionHandler;

Parameters

type

The type of file operation to perform.

completionHandler

The completion handler to call when the authorization request is completed.

The completion handler takes two parameters:

authorization

The authorization granted for this app. Use it when creating a new NSFileManager with fileManagerWithAuthorization:.

error

nil if the app is authorized; otherwise, a pointer to the authorization error.

See Also

Performing Privileged Operations

NSWorkspaceAuthorization

The authorization granted to the app by the user.

NSWorkspaceAuthorizationType

The types of privileged file operations that can be authorized by the user.