Contents

AEAssessmentSession

A session that your app uses to protect an assessment.

Declaration

class AEAssessmentSession

Overview

Use the AEAssessmentSession class to manage an assessment session. The system allows only one active session at a time across all processes. The first session to run gets exclusive access to the system; subsequent session attempts fail until the first session ends.

To create an assessment session, pass a new AEAssessmentConfiguration instance to the init(configuration:) method. Then, provide the session with a delegate that conforms to the AEAssessmentSessionDelegate protocol:

You can indicate exceptions to the restrictions imposed by an assessment session by setting the properties of the configuration instance, or you can use the default restrictions as shown above. The session tells its delegate about state changes during its life cycle. To start a session, call the session’s begin() method:

The method returns immediately, and the session starts disabling system features. After achieving the desired state, the session calls its delegate’s assessmentSessionDidBegin(_:) method. Only after receiving this callback is it safe to begin your assessment. Be sure to keep a strong reference to the session as long as you want it to remain active. If the system deallocates an active session, the session automatically ends.

After completing an assessment and hiding all sensitive information, call the session’s end() method:

After making the call, wait for the session to call its delegate’s assessmentSessionDidEnd(_:) method before reporting assessment completion to the user.

During assessment, the session’s delegate might receive an assessmentSession(_:wasInterruptedWithError:) callback to indicate a failure. If this happens, immediately stop the assessment, hide all sensitive content, and end the session. Because it might take time for your app to finalize the assessment, the session relies on your app to call the session’s end() method:

Topics

Creating a session

Managing session configuration

Responding to session updates

Starting and stopping a session

See Also

Sessions