UIGuidedAccessRestrictionDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 7.0 and later.
Declared in
UIGuidedAccessRestrictions.h

Overview

Adopting the UIGuidedAccessRestrictionDelegate protocol in your application delegate allows you to add custom restrictions for the Guided Access feature in iOS.

Custom restrictions are represented by string identifiers provided by the developer in the guidedAccessRestrictionIdentifiers method. Each identifier represents an operation in the app that the developer wishes to allow users to restrict using Guided Access. The default for all operations is allow. Users can deny operations using the normal Guided Access user interface. See http://support.apple.com/kb/HT5509 for a description of how to enable and configure Guided Access on iOS.

Apps describe their custom restrictions by implementing the textForGuidedAccessRestrictionWithIdentifier: and detailTextForGuidedAccessRestrictionWithIdentifier: methods to return appropriate localized, human-readable strings.

For example, a photo editing app might allow users to disable deleting photos. The app would return an identifier representing this restriction in its guidedAccessRestrictionIdentifiers method. It would also implement textForGuidedAccessRestrictionWithIdentifier: to provide a human-readable description of the restriction. Finally, the app would implement guidedAccessRestrictionWithIdentifier:didChangeState: to notice when a user indicates that they want to enable the restriction. When the app sees the state change to “deny”, it would configure itself to prevent the deletion of photos by any means. Similarly, when the app sees the state change to “allow”, it would configure itself to allow photo deletion.

Apps can use the UIGuidedAccessRestrictionStateForIdentifier function to check the state of a restriction at any time.

Tasks

Identifying Custom Guided Access Restrictions

Implementing Restrictions

Instance Methods

detailTextForGuidedAccessRestrictionWithIdentifier:

Returns more detailed information about the restriction for the provided identifier.

- (NSString *)detailTextForGuidedAccessRestrictionWithIdentifier:(NSString *)restrictionIdentifier;
Parameters
restrictionIdentifier

The identifer of the restriction the system is interested in.

Return Value

A localized, human-readable string that provides additional information about the restriction for the provided identifier.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIGuidedAccessRestrictions.h

guidedAccessRestrictionIdentifiers

Returns an array of strings identifying custom restrictions. (required)

- (NSArray *)guidedAccessRestrictionIdentifiers;
Return Value

An array of NSString objects, each of which represents a custom restriction.

Discussion

Your delegate must implement this method and return an array with an identifier string for each custom guided access restriction you wish to provide in your app.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIGuidedAccessRestrictions.h

guidedAccessRestrictionWithIdentifier:didChangeState:

Para (required)

- (void)guidedAccessRestrictionWithIdentifier:(NSString *)restrictionIdentifier didChangeState:(UIGuidedAccessRestrictionState)newRestrictionState;
Parameters
restrictionIdentifier

The identifer of the restriction whose state has changed.

newRestrictionState

The new state for the restriction.

Discussion

Your app should adjust its behavior to allow or deny the operation controlled by the specified restriction each time it receives this message.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIGuidedAccessRestrictions.h

textForGuidedAccessRestrictionWithIdentifier:

Returns a succinct description of the restriction for the provided identifier. (required)

- (NSString *)textForGuidedAccessRestrictionWithIdentifier:(NSString *)restrictionIdentifier;
Parameters
restrictionIdentifier

The identifer of the restriction the system is interested in.

Return Value

A localized, human-readable string that succinctly describes the restriction for the provided identifier.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIGuidedAccessRestrictions.h

Constants

UIGuidedAccessRestrictionState

The state of a restriction, either allow or deny.

typedef enum : NSInteger {
   UIGuidedAccessRestrictionStateAllow,
   UIGuidedAccessRestrictionStateDeny
} UIGuidedAccessRestrictionState;
Constants
UIGuidedAccessRestrictionStateAllow

The app should allow the user to perform the action controlled by the restriction.

Available in iOS 7.0 and later.

Declared in UIGuidedAccessRestrictions.h.

UIGuidedAccessRestrictionStateDeny

The app should deny the user from performing the action controlled by the restriction.

Available in iOS 7.0 and later.

Declared in UIGuidedAccessRestrictions.h.