UIApplication.userDidTakeScreenshotNotification: the complete guide (iOS)
UIApplication.userDidTakeScreenshotNotification is the iOS API most developers find when they
want to detect that a user took a screenshot.
It is useful, but it has sharp boundaries. It tells you that a screenshot happened. It does not give you the image, fire before capture, or let you block the user from taking the screenshot.
What is UIApplication.userDidTakeScreenshotNotification?
UIApplication.userDidTakeScreenshotNotification is a notification posted by iOS after the user
takes a screenshot. Apps can register an observer for this notification and respond after the
capture, for example by opening a bug report UI, showing a confirmation, or recording an analytics
event. The notification is informational only: it does not include the screenshot image and it does
not allow the app to cancel the screenshot.
How to observe it
In Swift, register an observer with NotificationCenter:
final class ScreenshotObserver {
private var token: NSObjectProtocol?
func start() {
token = NotificationCenter.default.addObserver(
forName: UIApplication.userDidTakeScreenshotNotification,
object: nil,
queue: .main
) { _ in
print("User took a screenshot")
}
}
func stop() {
if let token {
NotificationCenter.default.removeObserver(token)
}
}
}
In Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userDidTakeScreenshot:)
name:UIApplicationUserDidTakeScreenshotNotification
object:nil];
Remove observers when the owning object is deallocated or no longer needs screenshot events.
What it fires on
| User action | Does it fire? | Notes |
|---|---|---|
| Hardware screenshot | Yes | Posted after the screenshot is taken |
| Assistive screenshot action | Yes | Treated as a user screenshot |
| Screen recording starts | No | Use screen capture APIs instead |
| Screen is mirrored or captured | No | Check UIScreen.isCaptured for capture state |
| App attempts to take its own snapshot | No | This is not a user screenshot notification |
| Simulator screenshot | Usually yes for simulated user screenshots | Verify your test path on the simulator version you use |
You cannot get the screenshot image from the notification
This is the gotcha. The notification tells you that a screenshot happened, but the notification payload does not contain the saved screenshot.
If you need an image for a bug report, you have two common options. You can ask for Photos access and locate the recent screenshot, or you can capture your app's current view yourself after the notification. Both approaches have product and privacy tradeoffs, so be explicit about what you collect and why.
Version and privacy considerations
Use public APIs only. Screenshot detection is allowed, but users should understand why your app is reacting to screenshots. A bug reporting flow is a clear use case: the screenshot is treated as the start of a report that the user can review before submitting.
Do not assume screenshot detection is a security boundary. iOS allows users to capture their screen, and this notification is not a prevention mechanism.
Using it for bug reporting
BugScreen uses iOS screenshot detection as a low-friction trigger for bug reporting. When a tester takes a screenshot, the app can open a native reporting flow, let the tester add a short note, and send the report to the tracker with device and build context.
For the broader concept, read how screenshot detection works on iOS. For SDK setup, see the iOS docs.
Frequently asked questions
What is UIApplication.userDidTakeScreenshotNotification?
UIApplication.userDidTakeScreenshotNotification is an iOS notification posted after the user takes a screenshot. Apps can observe it to react to screenshots, but the notification does not include the screenshot image.
Can you detect screenshots on iOS reliably?
You can reliably observe the system notification after a user screenshot is taken while your app is active. You cannot prevent the screenshot, intercept it before capture, or get the image directly from the notification.
Does userDidTakeScreenshotNotification fire for screen recordings?
No. userDidTakeScreenshotNotification is for screenshots, not screen recordings. Screen recording state is handled separately through APIs such as UIScreen.isCaptured.