ENManager
A class that manages exposure notifications.
Declaration
class ENManagerOverview
Before using an instance of this class, call activate(completionHandler:). If the completion handler completes successfully, you can work with the remaining properties and methods on the class. Activating this object doesn’t enable exposure notification; it only allows this object to be used. Once activated, exposure notification can be enabled with setExposureNotificationEnabled(_:completionHandler:), if needed.
If the app no longer needs an instance of this class, you must call invalidate(), which stops any outstanding operations and invokes the invalidation handler.
The framework invokes the invalidation handler once invalidation finishes, and performs the invocation exactly once, even if invalidate() is called multiple times. It does not call any additional handlers.
After calling invalidate(), your app can’t reuse the object. A new object must be created for subsequent use. The framework clears strong references once invalidation completes to break potential retain cycles. You don’t need to use weak references within your handlers to avoid retain cycles when using this class.
Topics
Activating the Manager
activate(completionHandler:)activityHandlerENActivityHandlerENActivityFlagssetExposureNotificationEnabled(_:completionHandler:)
Obtaining Exposure Information
detectExposures(configuration:diagnosisKeyURLs:completionHandler:)detectExposures(configuration:completionHandler:)getExposureWindows(summary:completionHandler:)ENGetExposureWindowsHandlergetUserTraveled(completionHandler:)ENGetUserTraveledHandlergetExposureInfo(summary:userExplanation:completionHandler:)
Obtaining Exposure Keys
Configuring the Manager
Preauthorizing Exposure Keys
requestPreAuthorizedDiagnosisKeys(completionHandler:)preAuthorizeDiagnosisKeys(completionHandler:)ENDiagnosisKeysAvailableHandlerdiagnosisKeysAvailableHandler
Invalidating the Manager
Instance Properties
See Also
Essentials
Supporting Exposure Notifications ExpressBuilding an App to Notify Users of COVID-19 ExposureSetting Up a Key ServerENDeveloperRegionENAPIVersionChanging Configuration Values Using the Server‑to‑Server APITesting Exposure Notifications Apps in iOS 13.7 and LaterSupporting Exposure Notifications in iOS 12.5