System permissions on iOS

When a flow runs the Request permission action, the Adapty SDK sends the permission request to your app. Your app shows the system dialog and passes the result to the flow. Follow this reference to write the iOS code that passes the result of each permission request to the flow. For each permission that the action can request, this page describes:

  • What users see.
  • What your app declares, and how it requests the permission.
  • The responses that iOS can give to each permission request.
  • How your app passes each response to the flow, as a result and its argument.

Set up the permission handler

Before you follow this reference, set up a permission handler: the code in your app that receives each permission request and passes the result back. This page only covers what to request and which result to pass for each permission.

Add the request to a flow

To ask users for a system permission, in the Flow & Paywall Builder, add the Request permission action to a screen of your flow.

How to pass the result

Return the result

In the handlePermission(_:withCustomArgs:) method, return .granted or .denied, with the argument from the table of the permission. For example, this camera function returns the result of a camera request: granted, declined in the alert, declined before the request, or blocked by a device policy.

import AdaptyUI
import AdaptyUIBuilder
import AVFoundation

extension FlowPermissionHandler {
    func requestCamera() async -> AdaptyPermissionResult {
        switch AVCaptureDevice.authorizationStatus(for: .video) {
        case .authorized:
            return .granted("granted")
        case .denied:
            // The user declined earlier: iOS shows no alert.
            return .denied("permanently_denied")
        case .restricted:
            return .denied("restricted")
        case .notDetermined:
            let granted = await AVCaptureDevice.requestAccess(for: .video)
            return granted ? .granted("granted") : .denied("denied")
        @unknown default:
            return .denied(nil)
        }
    }
}

If your app uses a cross-platform SDK , pass the same values with the call that its guide shows.

Prepare the handler for each system response

For each permission, iOS reports one of several authorization statuses. The table in each permission section lists every status, and the result that your handler returns for it. Your code for a permission needs one case for each row. For example, the camera function above has a case for each row of the camera table.

What the flow does with the result

After your app passes the result, the flow runs the After response actions. The default action is Navigate Next, so users go to the next screen whether they grant the permission or decline it. Without an After response action, users stay on the screen.

To send users who grant the permission and users who decline it to different screens, add actions to When allowed and When denied. The flow then runs these actions instead of the After response actions:

  • When allowed actions: After the user grants the permission.
  • When denied actions: After your app passes denied, restricted, or permanently_denied to the flow.

If the only When allowed or When denied action is Do nothing, the flow moves on to the After response actions. To keep users who decline on the screen, remove every action from After response. Users who grant the permission then need their own way forward: add Navigate Next to When allowed.

Pass the argument (in React Native and Capacitor, the detail property) that matches the result:

  • For a granted result: granted. Use limited if the user granted part of the access, such as a selection of photos. Use provisional for provisional authorization, which iOS grants in two cases:
    • Push notifications: If your app requests provisional authorization, iOS grants it without asking the user. The notifications then arrive quietly, in the Notification Center only, until the user decides to keep them or turn them off.
    • Location always: iOS asks for Always access in two alerts. Allow While Using App in the first alert grants Always access until the second alert. iOS shows the second alert when the app first needs location in the background. In it, the user selects Keep Only While Using or Change to Always Allow.
  • For a not-granted result: denied. Use restricted if a device policy, such as parental controls, blocks the permission. Use permanently_denied if the system no longer shows the dialog to the user.
  • For a permission your app doesn’t request: unsupported, with a not-granted result and no dialog.
  • When the user made no choice: No argument. For example, the user closed the dialog, or the OS reported no decision before the timeout in your code. The flow then runs the After response actions.

Pass the arguments in lowercase, exactly as written. For a not-granted result with any other argument, such as Denied or an error message, the flow runs the After response actions.

Rules for every permission

  • Only write code for the permissions your app uses: When your app code calls an API that requests a permission, such as the CLLocationManager class for location access, Info.plist needs a purpose string for that permission. A purpose string is the text in Info.plist that tells users why your app needs the permission. Info.plist needs this string even if a flow never requests the permission. Apple notes that libraries and SDKs can reference APIs that require a purpose string too. If a flow requests a permission that your app doesn’t use, return .denied("unsupported") without a request. One default case in the switch statement of your handler covers all of these permissions.

  • Read the authorization status before you request the permission: Your app can read the authorization status without an alert. For example, the AVCaptureDevice.authorizationStatus(for:) method returns the status of camera access. If the status shows that the user or a device policy decided the permission before this request, don’t call the request method. Pass the result for this status from the table of the permission.

    iOS shows each permission alert once per app install, because iOS keeps the user’s choice. The following permissions are exceptions:

    • Location: After Allow Once expires, the location alert appears again. In a second alert, the user can upgrade access to Always or to precise location. The alert that asks for precise location can appear again in a later session.
    • Health data: The Health access sheet appears again for each data type that the app requests for the first time.
    • App tracking (ATT): In the EU, one year after the user grants or declines tracking in the alert, the app can ask again.
    • Calendar: On iOS 17 and later, after the user grants write-only access, the first request for full access shows a second alert.

    Outside these exceptions, a request for a decided permission shows no alert. Most request methods return the stored decision. Some never call back: for example, when the authorization status isn’t .notDetermined, the CLLocationManager.requestWhenInUseAuthorization() method does nothing and doesn’t call the locationManagerDidChangeAuthorization(_:) delegate method. After the first call to the requestAlwaysAuthorization() method, further calls have no effect.

  • Wait for indirect requests with a timeout: iOS has no request method for Bluetooth, Motion & Fitness, Local network, and HomeKit. The alert appears when the app first uses the framework. iOS reports the user’s choice to a delegate method or a query handler, or doesn’t report it at all. Wrap the wait in a timeout shorter than 60 seconds. Then pass the result for the current authorization status, or a not-granted result without an argument. After 60 seconds without a result, the flow reports the flow_permission_unanswered event and can send the next permission request. If your app then passes a late result for the first request, the flow can run the actions of the next request.

  • Tell a new refusal from an earlier refusal: In your analytics, you can tell users who declined the permission in the flow from users who declined it earlier. Both cases run the When denied actions. iOS keeps every refusal until the user changes it in Settings. Pass denied when the user declined the alert of this request. Pass permanently_denied when iOS showed no alert because the user declined before.

  • Don’t reuse an earlier result: Some grants expire. Allow Once in the location alert lasts while the app is in use. Temporary full accuracy expires on its own. Don’t store a result for a later request.

  • Reset the user’s decisions when you test: To see an alert again, delete the app, or open Settings > General > Transfer or Reset iPhone > Reset > Reset Location & Privacy, which resets every app. Deleting the app doesn’t reset every permission: Bluetooth access, for example, can survive a reinstall of the same bundle ID. To see the first alert again, use a build with a new bundle ID.

Notifications and tracking

Push notifications

  • What the user sees: An alert that asks for permission to send notifications.
  • Setup: The permission needs no key in Info.plist. Request the permission with the UNUserNotificationCenter.requestAuthorization(options:) method. To receive remote push notifications, the app also needs the Push Notifications capability and registers with APNs. The permission itself doesn’t need them.

Pass the result that matches the notification authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.authorized, or .ephemeral in an App ClipGranted, granted
.provisional, after a request with the .provisional optionGranted, provisional
requestAuthorization(options:) throws an errorNot granted, no argument
  • Limitations: iOS shows the alert once: later requests return the first decision. For a request with the .provisional option, iOS delivers notifications quietly, without asking the user first. They only appear in the Notification Center. The flow runs the When allowed actions right after this request. Use the .provisional option only if the flow expects that.

App tracking (ATT)

  • What the user sees: The App Tracking Transparency alert with your purpose string. In France, Germany, Italy, Poland, and Romania, iOS shows a full-page sheet instead of the alert. iOS shows nothing and returns the current authorization status when tracking is restricted, or when the user turned off Allow Apps to Request to Track in Settings. iOS also shows nothing when another request waits for the user’s choice, the request comes from an app extension, or the app isn’t active.
  • Setup: Add the NSUserTrackingUsageDescription key to Info.plist. An app that uses the AppTrackingTransparency framework without this key crashes. For the full-page sheet, you can add the NSUserTrackingMarkdownUsageDescription key. Request the permission with the ATTrackingManager.requestTrackingAuthorization() method.

Pass the result that matches the tracking authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the request. In the EU, less than a year after the user declined tracking in the alertNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
.notDetermined after the request: iOS closed the prompt without a decision, the app wasn’t active, or another request waited for the user’s choiceNot granted, no argument
  • How to pass the result:
    • Request tracking only while the app is active: iOS shows the alert only to an active app. An On Screen Appear request on the first screen after launch can arrive before the app is active, so before you request:

      1. Read the UIApplication.shared.applicationState property.
      2. If the app is active, request immediately.
      3. Otherwise, wait for the UIApplication.didBecomeActiveNotification notification, then request. Wrap the wait in a timeout shorter than 60 seconds: after 60 seconds without a result, the flow reports the flow_permission_unanswered event. If the timeout ends first, pass a not-granted result without an argument.

      Read the property first, because an app that is already active never receives this notification.

    • In the EU, one year after the user grants or declines the tracking permission, the app can ask again. This doesn’t apply when the user turned tracking off in Settings. Store the date of the user’s choice, and after a year, request again instead of returning .denied("permanently_denied"). See the requestTrackingAuthorization method.

    • After the user grants or declines tracking, send the tracking authorization status to Adapty. If your app uses a cross-platform SDK , send the status with the method of that SDK.

Location

Location while using the app

  • What the user sees: An alert with Allow Once, Allow While Using App, and Don’t Allow, and a Precise switch.
  • Setup: Add the NSLocationWhenInUseUsageDescription key to Info.plist. Request the permission with the CLLocationManager.requestWhenInUseAuthorization() method. iOS reports the authorization status to the locationManagerDidChangeAuthorization(_:) delegate method. When the app creates a CLLocationManager object, iOS calls this method with the current authorization status. Ignore .notDetermined, and only pass the result after a change that follows the request. The app must be in the foreground to show the alert.

Pass the result that matches the location authorization status:

What iOS reportsResult to pass
.notDetermined, then Allow While Using App or Allow OnceGranted, granted
.notDetermined, then Don’t AllowNot granted, denied
Still .notDetermined after the request, or no decision before the app’s timeoutNot granted, no argument
.denied before the request, including Location Services turned off and Airplane modeNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedWhenInUse or .authorizedAlwaysGranted, granted

To report approximate location in analytics, return .granted("limited") instead of .granted("granted"). The flow still runs the When allowed actions.

  • How to pass the result: Read the authorizationStatus property first. If it isn’t .notDetermined, pass the result without a request: the requestWhenInUseAuthorization() method does nothing in this case. Otherwise, request the permission, and wrap the wait in a timeout. If the NSLocationWhenInUseUsageDescription key is missing, the request fails without an alert. When the authorization status is already decided, or the key is missing, iOS doesn’t call the locationManagerDidChangeAuthorization(_:) delegate method. A handler that waits for this method never passes a result, and the flow stays on the screen.
  • Limitations: Allow Once grants access while the app is in use. The authorization status then returns to .notDetermined, so the alert appears again later.

Location always

  • What the user sees: Two steps.
    • Location access not granted or declined yet: The alert for location while using the app. Allow While Using App grants provisional Always access: Always access that the user hasn’t confirmed yet. Later, typically while the app isn’t running, iOS asks the user to select Keep Only While Using or Change to Always Allow.
    • Location while using the app already granted: The upgrade alert, with Keep Only While Using and Change to Always Allow, right after the request. After Allow Once, or after an earlier Always request, iOS ignores the request and shows nothing.
  • Setup: Add the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys to Info.plist. Request the permission with the CLLocationManager.requestAlwaysAuthorization() method. Location updates in the background also need the Background Modes capability. The permission itself doesn’t need it.

Pass the result that matches the location authorization status:

What iOS reportsResult to pass
.notDetermined, then Allow While Using App in the first alert: .authorizedAlways, provisional Always accessGranted, provisional
.notDetermined, then Allow Once in the first alert: .authorizedWhenInUse, temporary accessNot granted, denied
.notDetermined, then Don’t AllowNot granted, denied
Still .notDetermined after the request, or no decision before the app’s timeoutNot granted, no argument
.authorizedWhenInUse, the upgrade alert appears, then Change to Always AllowGranted, granted
.authorizedWhenInUse, the upgrade alert appears, then Keep Only While UsingNot granted, denied
.authorizedWhenInUse, and no alert appears: after Allow Once, or after an earlier Always requestNot granted, permanently_denied
.authorizedAlwaysGranted, granted
.deniedNot granted, permanently_denied
.restrictedNot granted, restricted
  • How to pass the result:
    • After the request, wait a short time for the alert, such as 2 seconds. iOS shows no alert when the user selected Allow Once earlier, or when the app already requested Always access. If no alert appears, pass the result for the authorization status. If the alert appears, wait until the user closes it, then pass the result. From .notDetermined, wait until the locationManagerDidChangeAuthorization(_:) delegate method reports another authorization status: each option in the first alert changes it. From .authorizedWhenInUse, wait until the app becomes active again: while an alert is on the screen, iOS makes the app inactive. Don’t wait for the delegate method after the upgrade alert: iOS doesn’t call it when the user selects Keep Only While Using, because the authorization status doesn’t change. Never wait longer than 60 seconds.
    • iOS accepts one Always request per install: later calls have no effect. iOS has no API that reports an earlier request. Store a true or false value instead: whether your app requested Always access before. Set the saved value to true after the first request.
  • Limitations: In the first alert, Allow While Using App reports .authorizedAlways for provisional Always access, and your app returns .granted("provisional"). Allow Once reports .authorizedWhenInUse for temporary access, without Always access, so your app returns .denied("denied"). On a later request, your app returns .granted("granted") for provisional Always access. After Allow Once, iOS ignores later Always requests, so your app returns .denied("permanently_denied") for a later request. A user with provisional Always access can select Keep Only While Using later, outside the flow.

Precise location

  • What the user sees: If the user turned off Precise in the location alert, iOS shows a second alert when your app requests precise location. In this alert, the user can switch to precise location until the app is no longer in use (Allow Once), or keep approximate location (Don’t Allow). The alert shows the text of your purpose key.
  • Setup: Add the NSLocationWhenInUseUsageDescription and NSLocationTemporaryUsageDescriptionDictionary keys to Info.plist. Each key of the dictionary is a purpose key, and its value is the text of the alert. Request the permission with the CLLocationManager.requestTemporaryFullAccuracyAuthorization(withPurposeKey:) method. The flow sends no purpose key, so the app code passes one of its own keys.
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
    <key>StoreFinder</key>
    <string>Find the store closest to you.</string>
</dict>

Pass the result that matches the location accuracy:

What iOS reportsResult to pass
Location .notDetermined, then the user grants location access with Precise onGranted, granted
Location .notDetermined, then the user denies location accessNot granted, denied
Still .notDetermined after the request, or no decision before the app’s timeoutNot granted, no argument
accuracyAuthorization is .fullAccuracy before the requestGranted, granted
.reducedAccuracy before, .fullAccuracy after the requestGranted, granted
The request completes without an error, and accuracyAuthorization is still .reducedAccuracy: the user declinedNot granted, denied
The request fails with promptDeclined: iOS didn’t show the alertNot granted, no argument
Location access .deniedNot granted, permanently_denied
Location access .restrictedNot granted, restricted
  • How to pass the result:
    • The iOS request needs location access while the app is in use. When the location authorization status is .notDetermined, request Location while using the app first: its alert has a Precise switch. If the user turns it off, continue with the request for precise location.
    • After the user’s choice in the alert, the request completes without an error. Read the accuracyAuthorization property after it. The promptDeclined error means that iOS didn’t show the alert. iOS doesn’t show it when the purpose key is missing from the dictionary, the app already has precise location, or the app is in the background.
  • Limitations: Precise location from this request is temporary: it expires on its own, and iOS postpones the expiration while the app is in use. The alert can appear again in a later session. Precise location that the user selected in the location alert or in Settings doesn’t expire.

Camera and media

Camera

  • What the user sees: An alert with your purpose string.
  • Setup: Add the NSCameraUsageDescription key to Info.plist. Without this key, a request for camera access raises an exception, and iOS terminates the app. Request the permission with the AVCaptureDevice.requestAccess(for:) method and the .video media type.

Pass the result that matches the camera authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations: Until the user grants camera access, iOS gives the app black frames.

Microphone

  • What the user sees: An alert with your purpose string.
  • Setup: Add the NSMicrophoneUsageDescription key to Info.plist. Without this key, the app exits when it tries to use the microphone. Request the permission with the AVCaptureDevice.requestAccess(for:) method and the .audio media type. On iOS 17 and later, you can use the AVAudioApplication.requestRecordPermission() method instead.

Pass the result that matches the microphone authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations: Without the permission, recordings contain silence. The record permission of the AVAudioApplication class has the values .undetermined, .granted, and .denied, with no restricted value: with this class, your app never passes restricted.

Photos

  • What the user sees: An alert where the user selects limited access, full access, or no access. Limited access opens a system picker where the user selects photos and videos.
  • Setup: Add the NSPhotoLibraryUsageDescription key to Info.plist. Request the permission with the PHPhotoLibrary.requestAuthorization(for:) method and the .readWrite access level. If the app only adds photos, declare the NSPhotoLibraryAddUsageDescription key, and request the .addOnly access level instead: add-only access has no limited state. Without a valid purpose string, the app crashes when it accesses the photo library. The older requestAuthorization(_:) method reports limited access as .authorized.

Pass the result that matches the photo library authorization status:

What iOS reportsResult to pass
.authorizedGranted, granted
.limited: the user selected some photosGranted, limited
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
  • Limitations:
    • For an app with limited access, once per app life cycle, iOS shows an alert where the user can update the selection of photos. To turn off this alert, set the PHPhotoLibraryPreventAutomaticLimitedAccessAlert key to true in Info.plist.
    • The PHPickerViewController photo picker needs no permission. App Review Guideline 5.1.1 asks apps to use such a picker instead of full access where they can. Request this permission when the app shows its own gallery.

Media library

  • What the user sees: An alert that asks for access to Apple Music and the media library, with your purpose string.
  • Setup: Add the NSAppleMusicUsageDescription key to Info.plist. The app must have this key to access the media library. Request the permission with the MPMediaLibrary.requestAuthorization() method.

Pass the result that matches the media library authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations: Media library and Apple Music show the same purpose string, from the NSAppleMusicUsageDescription key, and share one authorization status. After the user grants or declines one of them, a request for the other one returns that decision without an alert.

Apple Music

  • What the user sees: An alert that asks for access to Apple Music and the media library, with your purpose string.
  • Setup: Add the NSAppleMusicUsageDescription key to Info.plist. Without this key, iOS terminates the app when the app accesses the user’s music. Request the permission with the MusicKit MusicAuthorization.request() method. The SKCloudServiceController.requestAuthorization(_:) method returns the same authorization but is deprecated in iOS 18. Use it only where the app can’t call MusicKit, for example from a wrapper’s permission library.

Pass the result that matches the MusicKit authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations:
    • The permission covers the user’s Apple Music data. Playback of catalog content also needs an active Apple Music subscription, which the MusicKit MusicSubscription structure reports separately.
    • Apple Music and Media library share one authorization status. After the user grants or declines one of them, a request for the other one returns that decision without an alert. For example, after a refusal, your app returns .denied("permanently_denied") for the other one.

Speech recognition

  • What the user sees: An alert with your purpose string.
  • Setup: Add the NSSpeechRecognitionUsageDescription key to Info.plist. Without this key, the app crashes when it calls the SFSpeechRecognizer.requestAuthorization(_:) method. Mark the closure that you pass to this method as @Sendable. In the Swift 6 language mode, an unmarked closure in a @MainActor class inherits main-actor isolation. If iOS calls the closure on a queue other than the main queue, the app crashes. To recognize live audio, the app also needs the NSMicrophoneUsageDescription key and the Microphone permission.

Pass the result that matches the speech recognition authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations:
    • The permission only covers speech recognition with the SFSpeechRecognizer class. SpeechAnalyzer transcriber modules don’t send audio to Apple and don’t need it.
    • Speech recognition of live audio needs two permissions: Microphone and Speech recognition. The flow sends one permission request at a time, so set up the two permissions in one of two ways:
      • In the flow, add a Request permission action for each permission, on two screens.
      • In your app code for Speech recognition, request the microphone permission first, then speech recognition, and pass one result for both.

Personal data

Contacts

  • What the user sees: An alert with your purpose string. On iOS 18 and later, the user can share all contacts or a selection.
  • Setup: Add the NSContactsUsageDescription key to Info.plist. Request the permission with the CNContactStore.requestAccess(for:) method and the .contacts entity type. The request only reports whether the user gave access, so read the authorization status with the CNContactStore.authorizationStatus(for:) method after it, also when it throws an error. The authorization status tells limited access from full access.

Pass the result that matches the contacts authorization status:

What iOS reportsResult to pass
.authorizedGranted, granted
On iOS 18 and later, .limited: the user shared a selection of contactsGranted, limited
.notDetermined, then the user declinesNot granted, denied
Still .notDetermined after the request, or no decision before the app’s timeoutNot granted, no argument
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
  • Limitations:
    • Limited access on iOS 18 and later takes four steps: the alert, a sheet that asks how to share, the contact picker, and a confirmation. A user can take more than 60 seconds, so the flow can send the flow_permission_unanswered event with on_screen in the outcome property before your app passes the result. If the user is still on the screen that sent the request, the flow runs the actions for the late result.
    • To add contacts to the selection after the user grants limited access, use the ContactAccessButton view or the contactAccessPicker view modifier.
    • App Review Guideline 5.1.1 asks apps to use a system picker instead of full access to contacts where they can.

Calendar

  • What the user sees: An alert with your purpose string for full access or for adding events only.
  • Setup: For full access on iOS 17 and later, add the NSCalendarsFullAccessUsageDescription key to Info.plist. To add events only, use the NSCalendarsWriteOnlyAccessUsageDescription key instead. Request the permission with the EKEventStore.requestFullAccessToEvents() or requestWriteOnlyAccessToEvents() method. For iOS 16 and earlier, also declare the NSCalendarsUsageDescription key. On these versions, request the permission with the requestAccess(to:) method and the .event entity type.

Pass the result that matches the calendar authorization status:

What iOS reportsResult to pass
.fullAccess, or .authorized on iOS 16 and earlierGranted, granted
On iOS 17 and later, .writeOnly, and the app requested write-only accessGranted, granted
On iOS 17 and later, .writeOnly, and the app requested full accessGranted, limited
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
The request throws an errorNot granted, no argument
  • Limitations:
    • On iOS 17 and later, iOS denies every request from an app with only the NSCalendarsUsageDescription key, without an alert.
    • The value calendar doesn’t say which access to request: your app decides. iOS has no read-only access. An app with write-only access sees one virtual calendar and no events.
    • To add an event without calendar access, use the EKEventEditViewController view controller on iOS 17 and later.

Reminders

  • What the user sees: An alert with your purpose string.
  • Setup: On iOS 17 and later, add the NSRemindersFullAccessUsageDescription key to Info.plist. Request the permission with the EKEventStore.requestFullAccessToReminders() method. For iOS 16 and earlier, also declare the NSRemindersUsageDescription key. On these versions, request the permission with the requestAccess(to:) method and the .reminder entity type. On iOS 17 and later, iOS uses the NSRemindersUsageDescription key as a fallback when the NSRemindersFullAccessUsageDescription key is missing.

Pass the result that matches the reminders authorization status:

What iOS reportsResult to pass
.fullAccess, or .authorized on iOS 16 and earlierGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
The request throws an errorNot granted, no argument
  • Limitations: iOS has no write-only access to reminders.

Health data

  • What the user sees: The Health access sheet for the data types that the app requests.
  • Setup:
    • Add the HealthKit capability.
    • To read health data, add the NSHealthShareUsageDescription key to Info.plist. To write health data, add the NSHealthUpdateUsageDescription key. Without these keys, the app crashes when it requests access.
    • Request the permission with the HKHealthStore.requestAuthorization(toShare:read:) method. Call the HKHealthStore.isHealthDataAvailable() method first. The flow sends no data types, so the app code passes its own. Before the request, the getRequestStatusForAuthorization(toShare:read:) method tells whether iOS will show the sheet.
    • When you add the HealthKit capability, Xcode adds the healthkit entry to the UIRequiredDeviceCapabilities key. This entry blocks installs on devices without HealthKit. If the app works without health data, remove the entry.

Pass the result that matches the health data access:

What iOS reportsResult to pass
isHealthDataAvailable() returns falseNot granted, unsupported
The request fails with errorHealthDataRestrictedNot granted, restricted
The request completes, and the app requested only read accessNot granted, no argument
Every requested write type is .sharingAuthorizedGranted, granted
Some requested write types are .sharingAuthorizedGranted, limited
No requested write type is authorized, after the sheetNot granted, denied
No requested write type is authorized, and getRequestStatusForAuthorization returned .unnecessary before the request: iOS showed no sheetNot granted, permanently_denied
The request throws another errorNot granted, no argument
  • Limitations:
    • iOS doesn’t tell the app whether the user granted read access to health data. If the user denies reading, queries return no data. For a request that only asks for read access, your app returns .denied(nil), and the flow runs the After response actions: put the next step of the flow there. Only a request for write types reports the user’s choice.
    • iOS shows the sheet again when the app requests a data type for the first time. It doesn’t ask again for a type that the user granted or declined.

Motion & Fitness

  • What the user sees: An alert with your purpose string the first time the app accesses motion activity data.
  • Setup: Add the NSMotionUsageDescription key to Info.plist. Without this key, the app crashes when it accesses motion data. iOS has no request method: the first access to motion activity data shows the alert, and iOS reports the user’s choice to the handler of that access. Call the CMMotionActivityManager.isActivityAvailable() method first. Read the authorization status with the CMMotionActivityManager.authorizationStatus() method.

Pass the result that matches the motion authorization status:

What iOS reportsResult to pass
isActivityAvailable() returns false: the device has no motion dataNot granted, unsupported
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
Still .notDetermined when the timeout endsNot granted, no argument
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • How to pass the result: Wait for the query handler of the motion data access with a timeout. Then read the authorization status with the authorizationStatus() method, and pass the result that matches it.

Device and home

Bluetooth

  • What the user sees: An alert with your purpose string the first time the app creates a Bluetooth manager.
  • Setup: Add the NSBluetoothAlwaysUsageDescription key to Info.plist. Without this key, the app crashes when it uses Core Bluetooth. iOS has no request method: when the app creates a CBCentralManager object, iOS shows the alert and then calls the centralManagerDidUpdateState(_:) delegate method. Read the CBManager.authorization property first. Create the manager with the CBCentralManagerOptionShowPowerAlertKey option set to false, so that iOS doesn’t also ask the user to turn on Bluetooth.

Pass the result that matches the Bluetooth authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
Still .notDetermined when the timeout endsNot granted, no argument
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.allowedAlwaysGranted, granted
  • How to pass the result:
    • Wait for the centralManagerDidUpdateState(_:) delegate method with a timeout. Then pass the result that matches the CBManager.authorization property.
    • A Bluetooth adapter that is turned off isn’t a refusal. Pass the result that matches the permission, not the adapter state.

Local network

  • What the user sees: An alert with your purpose string the first time the app accesses the local network.
  • Setup: Add the NSLocalNetworkUsageDescription key to Info.plist. For each Bonjour service type that the app browses or advertises, add an entry such as _myservice._tcp to the NSBonjourServices key. Multicast and broadcast also need the com.apple.developer.networking.multicast entitlement, which Apple must approve. iOS has no request method and no authorization status API. A local network operation shows the alert, such as a Bonjour browse or a connection to a device on the network.

Pass the result that matches the outcome of a local network operation:

What iOS reportsResult to pass
An outgoing operation that needs local network access succeeds, such as a Bonjour browse or an outgoing TCP connectionGranted, granted
The operation fails, or gets no result before the app’s timeoutNot granted, no argument
The app has no local network featureNot granted, unsupported
  • How to pass the result: Keep the timeout short, such as 20 seconds. Never wait 60 seconds or more: at 60 seconds without a result, the flow reports the flow_permission_unanswered event.
  • Limitations:
    • Your app learns nothing when the user declines. The flow stays on the screen until your app’s timeout expires, then runs the After response actions, with no_status in the outcome property. For this permission, the flow never runs the When denied actions.
    • iOS doesn’t report the local network authorization status. iOS can deny the operation that shows the alert before the user’s choice, so a failed operation doesn’t mean a refusal. Put the next step of the flow in After response.
    • In the background, iOS denies a local network operation without an alert and doesn’t store the result. The alert appears at the next operation in the foreground.
    • The iOS Simulator doesn’t apply local network privacy. Test on a device.

HomeKit

  • What the user sees: An alert with your purpose string the first time the app uses HomeKit.
  • Setup: Add the HomeKit capability, and add the NSHomeKitUsageDescription key to Info.plist. Without the key, the app crashes the first time it uses HomeKit. iOS has no request method: when the app creates an HMHomeManager object, iOS shows the alert. iOS reports the authorization status to the homeManager(_:didUpdate:) delegate method, and the HMHomeManager.authorizationStatus property returns it. Keep one HMHomeManager object for the life of the app.

The HomeKit authorization status is a set of flags. Pass the result that matches the flags:

What iOS reportsResult to pass
.authorized is setGranted, granted
.determined without .authorized, after the alertNot granted, denied
.determined without .authorized, before the requestNot granted, permanently_denied
.determined isn’t set when the timeout endsNot granted, no argument
  • How to pass the result: After a refusal in an earlier launch, iOS calls no delegate method: a new HMHomeManager object already has the decided authorization status. Read the authorizationStatus property right after you create the manager, and again while you wait for the user’s choice, with a timeout. Apple defines the .restricted flag as “The app doesn’t have access to home data”, not as a device policy, so don’t pass restricted for it.

Focus status

  • What the user sees: An alert with your purpose string that asks to share the Focus status.
  • Setup: Add the NSFocusStatusUsageDescription key to Info.plist before the app uses the INFocusStatusCenter class. Request the permission with the INFocusStatusCenter.default.requestAuthorization() method. To read the Focus status after the user grants the permission, the app also needs notification authorization and the Communication Notifications capability.

Pass the result that matches the Focus status authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.notDetermined after the request: the user selected neitherNot granted, no argument
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted

Siri

  • What the user sees: An alert with your purpose string that asks to use Siri with the app.
  • Setup: Add the Siri capability, and add the NSSiriUsageDescription key to Info.plist. Request the permission with the INPreferences.requestSiriAuthorization(_:) method. Mark the closure that you pass to this method as @Sendable. In the Swift 6 language mode, an unmarked closure in a @MainActor class inherits main-actor isolation. If iOS calls the closure on a queue other than the main queue, the app crashes. Apple requires the Siri capability for the authorization to succeed. In an app without the capability, every call to the INPreferences class raises an exception, including a call to the siriAuthorizationStatus() method, and the app crashes. There, return .denied("unsupported") without a call to the INPreferences class.

Pass the result that matches the Siri authorization status:

What iOS reportsResult to pass
.notDetermined, then the user grants the permissionGranted, granted
.notDetermined, then the user declinesNot granted, denied
.denied before the requestNot granted, permanently_denied
.restrictedNot granted, restricted
.authorizedGranted, granted
  • Limitations:
    • An app that only supports actions in the Shortcuts app doesn’t need this permission.
    • Siri or Maps can ask the user for this permission on the app’s behalf, the first time the user uses one of the app’s intents. The user can then decide before the flow sends the request.