
Camera access allows an iOS app to capture photos or videos using the device camera .
Camera access allows an iOS app to capture photos or videos using the device camera.
Photo Library access allows an app to select and use existing images/videos stored on the device.
π In simple words:
A built-in iOS class used to:
To handle results:
UIImagePickerControllerDelegateUINavigationControllerDelegateiOS requires user permission:
import UIKit
if UIImagePickerController.isSourceTypeAvailable(.camera) {
print("Camera available")
}
let picker = UIImagePickerController()
picker.sourceType = .camera
picker.delegate = self
present(picker, animated: true)
let picker = UIImagePickerController()
picker.sourceType = .photoLibrary
picker.delegate = self
present(picker, animated: true)
func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[.originalImage] as? UIImage {
imageView.image = image
}
picker.dismiss(animated: true)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true)
}
User taps button
β
UIImagePickerController opens
β
Camera / Photo Library
β
User selects or captures image
β
Delegate returns image
β
Image displayed in app
Add in Info.plist:
Privacy - Camera Usage Description
We need camera access to take photos.
Privacy - Photo Library Usage Description
We need access to your photos.
Camera β capture new images
Photo Library β select existing images
Uses UIImagePickerController
Requires permissions in Info.plist
Delegate methods handle results
Must test camera on real device
Common in:
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.