<!--
{
  "documentType" : "article",
  "framework" : "SensitiveContentAnalysis",
  "identifier" : "/documentation/SensitiveContentAnalysis/detecting-nudity-in-media-and-providing-intervention-options",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Detecting sensitive content in media and providing intervention options"
}
-->

# Detecting sensitive content in media and providing intervention options

Alert people before displaying images or video that might be sensitive.

## Discussion

In iOS 17 and macOS 14, the Sensitive Content Warning user preference and the Communication Safety parental control in Screen Time let people indicate their desire to detect sensitive content in images and video. To provide people their preferred experience while those settings are active, use the Sensitive Content Analysis framework to check incoming media before displaying it.

When the framework flags user-provided media as sensitive, intervene by adjusting the user interface in a way that explains the situation and gives the person options to proceed. Avoid displaying flagged content until the person makes a decision.

The Sensitive Content Warning setting is for adults; Communication Safety in Screen Time is intended to protect content on the devices of children. Vary your app’s intervention strategy according to the active setting. For instance, keep interaction brief and unobstructive for adults; for children, use the full view, and communicate in age-appropriate language.

The Sensitive Content Analysis framework doesn’t dictate your user interface. You can tailor your app’s experience according to the examples in apps such as Messages. The following image depicts Messages in iOS 17 when a potentially explicit image arrives from a contact while the Sensitive Content Warning setting is on. Messages blurs the image with a UI that gives the person the option to display the flagged content. It also provides a menu of options to the person, such as blocking the contact or accessing Apple-provided resources on the web for topics like grooming, harassment, and online safety.

![An image of two iPhones side by side that display the Messages app. The phone on the left renders a view of an image that the user received in a conversation. A callout points to the image and contains the text Blurred view. Text referring to the blurred image reads: This may be sensitive. The view contains a button with the text Show and a callout that reads: UI to show content. The phone on the right displays the same conversation in Messages with a detailed image in the view. A callout extends from the detailed image that reads: Shown content. The view contains a button with a warning triangle, from which a callout extends with text that reads: Alternative / additional options.](images/com.apple.SensitiveContentAnalysis/detecting_nudity_in_media_and_providing_intervention_options-1@2x.png)

> Important:
> Apple provides the Sensitive Content Analysis framework to prevent people from viewing unwanted content, not as a way for an app to report on someone’s behavior. To protect privacy, don’t transmit any information off the person’s device about whether the Sensitive Content Analysis framework identified an image or video as containing sensitive content. For more information, see the [Developer Program License Agreement](https://developer.apple.com/programs/apple-developer-program-license-agreement/#sensitive-content-analysis-framework).

### Add the app entitlement

The OS requires the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.sensitivecontentanalysis.client> entitlement in your app’s code signature to use Sensitive Content Analysis. Calls to the framework fail to return positive results without it. You can add this entitlement to your app by turning on the Sensitive Content Analysis capability in Xcode; see <doc://com.apple.documentation/documentation/Xcode/adding-capabilities-to-your-app>.

Any team member of the paid App Store developer program can add the entitlement to an app after enabling the capability in Xcode and then signing the Developer Program License Agreement on the [Accounts](http://developer.apple.com/account) website.

> Note:
> The Sensitive Content Analysis entitlement isn’t available for Enterprise development or for people with free accounts.

### Check images or video for sensitive content

To check a user-provided image for sensitive content, create an [`SCSensitivityAnalyzer`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer) object.

```swift
let analyzer = SCSensitivityAnalyzer()
```

An app can utilize the Sensitive Content Analysis framework by detecting sensitive content when the system sets [`analysisPolicy`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer/analysisPolicy) to either:

- [`SCSensitivityAnalysisPolicy.simpleInterventions`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysisPolicy/simpleInterventions): Indicates someone turned on the Sensitive Content Warning preference in Settings.
- [`SCSensitivityAnalysisPolicy.descriptiveInterventions`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysisPolicy/descriptiveInterventions): Indicates that someone turned on the Communication Safety setting in Screen Time.

An app can’t leverage the Sensitive Content Analysis framework when the system sets [`analysisPolicy`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer/analysisPolicy) to [`SCSensitivityAnalysisPolicy.disabled`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysisPolicy/disabled). This indicates one or more of the following:

- The app lacks the necessary `com.apple.developer.sensitivecontentanalysis.client` entitlement.
- Neither the Sensitive Content Warning user preference nor the Communication Safety setting in Screen Time are active.
- One of the sensitive content detection settings is active, but the person turned off sensitive-content warnings for your app in Settings.

If [`analysisPolicy`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer/analysisPolicy) is [`SCSensitivityAnalysisPolicy.disabled`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysisPolicy/disabled), the Sensitive Content Analysis framework won’t detect sensitive content.

```swift
// Check the current analysis policy.
let policy = analyzer.analysisPolicy
if policy == .disabled { return }
```

If [`analysisPolicy`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer/analysisPolicy) is a value other than [`SCSensitivityAnalysisPolicy.disabled`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysisPolicy/disabled), you can check images or video for sensitive content. To check an image, call one of the `analyzeImage` functions passing in the user-provided image or a URL to an image.

```swift
// Analyze an image file at a particular URL.
let response = try await analyzer.analyzeImage(at: url)

// Analyze an image in memory.
let response = try await analyzer.analyzeImage(image.cgImage)
```

To analyze a video file, pass a video URL into the `videoAnalysis` function and wait
on the `hasSensitiveContent` function.

```swift
let handler = analyzer.videoAnalysis(forFileAt: videoFileUrl)
let response = try await handler.hasSensitiveContent()
```

> Note: To analyze a video stream rather than static files, see ``doc://com.apple.SensitiveContentAnalysis/documentation/SensitiveContentAnalysis/SCVideoStreamAnalyzer``.

### Tailor responses to content categories

When the framework detects sensitive content, check the [`detectedTypes`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalysis/detectedTypes) property to determine the specific categories present. This enables your app to provide context-appropriate interventions based on the nature of the content.

```swift
// Analyze an image and proceed if it contains sensitive content.     
let analysis = try await analyzer.analyzeImage(at: imageURL) 
guard analysis.isSensitive else {
    displayContent(imageURL)
    return
}
// Check for specific content types.
let detectedTypes = analysis.detectedTypes
// Check if the analysis detects nudity.  
if detectedTypes.contains(.sexuallyExplicit) {
    showContentWarning(
        message: "This image may contain nudity.",
        allowAccess: true
    )
}
// Check if the analysis detects gore or violence.
if detectedTypes.contains(.goreOrViolence) {
    blockContent(
        message: "This image may contain violence or gore.",
        offerResources: true
    )
}
// Handle the presenece of multiple content types differently.
if detectedTypes.isSuperset(of: [.sexuallyExplicit, .goreOrViolence]) {
    blockContent(
        message: "This image may contain multiple types of sensitive content.",
        offerResources: true
    )
}
```

Your app might choose to completely block content that contains graphic violence while allowing someone to view sexually explicit content after acknowledging a warning. The appropriate response depends on your app’s context and the active [`analysisPolicy`](/documentation/SensitiveContentAnalysis/SCSensitivityAnalyzer/analysisPolicy).

Consider implementing more cautious reveal mechanisms for gore and violence content compared to sexually explicit material. Because violent imagery can be traumatic on immediate exposure, progressive reveal interfaces—such as sliders that gradually remove blur—give people greater control over their exposure. In contrast, sexually explicit content interventions can use simpler acknowledgment patterns before revealing content.

> Note:
> The Sensitive Content Analysis framework sets ``doc://com.apple.SensitiveContentAnalysis/documentation/SensitiveContentAnalysis/SCSensitivityAnalysis/detectedTypes`` only when ``doc://com.apple.SensitiveContentAnalysis/documentation/SensitiveContentAnalysis/SCSensitivityAnalysis/isSensitive`` is `true`. Your app can continue to use `isSensitive` alone if you don’t need to differentiate between content categories.

### Handle performance implications

Although sensitivity checks incur additional image processing and introduce a delay while checking video, the presence of active user preferences indicate the person’s expectation to receive protections at the cost of time to review.

Depending on the amount of time that checks take to complete, adjust your app’s UI to accommodate the delay. For example, while checking video for sensitive content, use the `progress` property on the `videoAnalysis` return value to provide the person with status in a custom UI during the process.

```swift
let handler = analyzer.videoAnalysis(forFileAt: videoFileUrl)

// Track analysis and keep the person informed on progress.
let progress = handler.progress
```

### Tailor user interface for the Sensitive Content Warning setting

When your app detects sensitive content, present a UI that coordinates with the active
`analysisPolicy`.

When someone turns on the Sensitive Content Warning setting, keep the user interface brief. In addition:

- Display the UI in an unobstructive manner, such as inline with other content instead of using the full screen.
- Provide intervention as the app receives sensitive content from the network but allow the app to transmit unchecked content over the network.

For example, by providing a blurred version of the potentially sensitive image in its normal location, Messages on iOS 17 and later implements *inline* intervention. Messages also keeps the information presented in the UI brief by providing a one-word button to display the image, and an icon button for more options.

![An image of an iPhone displaying the Messages app. The app presents a conversation that contains an image the user received from a contact. The image is blurred, and contains text that reads: This may be sensitive. The image view contains two buttons, from which a callout extends that reads: Brief UI. The first button resides in the upper right corner of the image and contains a warning triangle. The second button resides in the lower right corner and contains the text Show. ](images/com.apple.SensitiveContentAnalysis/detecting_nudity_in_media_and_providing_intervention_options-2@2x.png)

### Tailor user interface for the Communication Safety parental control

When a person turns the Communication Safety option in Screen Time on, intervene in your app as it receives sensitive content over a network, and before transmitting sensitive content over a network.

Display the intervention in a modal view and use child-appropriate language in your UI. For example, Messages on macOS 14 and iOS 17 interrupts the normal flow of the app by presenting a modal sheet that describes flagged content with broadly understood terms, such as “a sensitive photo”.

![Screenshots of Messages running on two different Apple platforms. The platform on the left is macOS, and on the right, iOS. Each instance of Messages features a intervention flow that consists of a modal view. The view reads: This photo could be sensitive. Are you sure you want to view? The modal view contains text that provides a definition of sensitive content and it also describes the circumstances under which someone may receive sensitive content. Two buttons follow that read: Not Now and I’m Sure. The iOS device displays an additional button in between those two that reads Ways to Get Help.](images/com.apple.SensitiveContentAnalysis/detecting_nudity_in_media_and_providing_intervention_options-3@2x.png)

In addition, use two consecutive panes. The following image depicts Messages in iOS 17 when a child attempts to view a sensitive photo sent from a contact. Tapping “I’m sure” on the left raises the second pane on the right.

![Screenshots of two modal intervention panes. The pane on the left displays text that reads: This photo could be sensitive. Are you sure you want to view? Two buttons follow that read: Not Now and I’m Sure. The pane on the right displays text that reads: It’s your choice, but make sure you feel safe. Three buttons follow that read: Don’t View, Message a Grown-up, and View.](images/com.apple.SensitiveContentAnalysis/detecting_nudity_in_media_and_providing_intervention_options-4@2x.png)

Inline interventions for the Sensitive Content Warning setting aim to interfere minimally with an adult’s workflow while giving them quick access to help resources. The additional navigation required in the Communication Safety setting provides children with the opportunity to make a considered choice, and tries to avoid ever catching them off guard.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)