Detect permission of camera in iOS
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Checking camera permission on iOS is not just a UI concern. It is part of the app's runtime contract with the operating system. The correct implementation includes an Info.plist usage description, a permission-status check through AVCaptureDevice, and UI behavior for the authorized, denied, restricted, and not-determined states.
Add the Privacy Usage Description First
Before you request access, the app must declare why it needs the camera.
Add this key to Info.plist:
Without this key, the app will crash when trying to request camera access.
Read the Current Authorization Status
Use AVCaptureDevice.authorizationStatus(for: .video) to inspect the current state.
The possible states are:
- '
.authorized' - '
.denied' - '
.restricted' - '
.notDetermined'
Your app should treat each one differently.
Request Access When Status Is .notDetermined
Only request access when the user has not been prompted yet.
This system prompt appears at most once for the user unless they change permission in Settings later.
A Complete Permission Helper
This helper centralizes the logic and gives your UI one clear entry point.
Then use it before presenting camera UI.
Example View Controller Flow
This example checks status, requests if needed, and handles the main branches cleanly.
This keeps the permission flow explicit and avoids trying to present the camera when access is not available.
Understand denied Versus restricted
These states are easy to confuse:
- '
.deniedmeans the user explicitly said no.' - '
.restrictedusually means system policy, parental controls, or device management prevents access.'
For .restricted, sending the user to Settings may not solve the issue, so your UI should explain that access is unavailable rather than implying it is always user-fixable.
Build a Fallback User Experience
Permission denial should not crash the feature flow. A good camera feature provides:
- an explanatory screen or alert
- a Settings shortcut when appropriate
- a non-camera fallback if the product allows it
For example, a document-scanning app might offer manual file upload when the camera is unavailable.
Common Pitfalls
The biggest mistake is trying to request or use the camera without NSCameraUsageDescription in Info.plist. Another is treating .denied and .restricted as the same user-fixable state. Teams also sometimes request permission too early, before the user understands why the app needs the camera, which lowers grant rates. Finally, permission checks are often scattered across several controllers instead of being centralized in one helper or service.
Summary
- Add
NSCameraUsageDescriptionbefore requesting camera access. - Use
AVCaptureDevice.authorizationStatus(for: .video)to detect the current state. - Call
requestAccessonly when the status is.notDetermined. - Handle
.authorized,.denied, and.restrictedexplicitly in the UI flow. - Provide a Settings path or fallback behavior instead of failing silently.

