Szerkesztés

Megosztás a következőn keresztül:


ABAddressBook.RequestAccess(Action<Boolean,NSError>) Method

Definition

Presents the user with a standard permissions dialog, requesting access to the address book.

public void RequestAccess (Action<bool,Foundation.NSError> onCompleted);
member this.RequestAccess : Action<bool, Foundation.NSError> -> unit

Parameters

onCompleted
Action<Boolean,NSError>

Action called after the user has interacte with the permissions dialog.

Remarks

User's must give applications permission to access the ABAddressBook. This is done with a standard permissions dialog that is shown asynchronously (if necessary) by calling this asynchronous. The onCompleted Action is called after the user has interacted with the dialog.

NSError error;
addressBook = ABAddressBook.Create (out error);

if (addressBook != null) {
	addressBook.RequestAccess (delegate (bool granted, NSError accessError) {
		InvokeOnMainThread(() => accessStatus.Text = "Access " + (granted ? "allowed" : "denied"));
	});
}

Applies to

See also

  • <xref:AddressBook.ABAddressBok.GetAuthorizationStatus>