What is the purpose of UIImagePickerController in iOS development?
UIImagePickerController is a built-in class that lets users pick images or videos from their photo library or take new photos or videos using the camera.
Click to reveal answer
beginner
Which privacy key must be added to Info.plist to access the camera?
You must add the key NSCameraUsageDescription with a message explaining why your app needs camera access.
Click to reveal answer
beginner
How do you check if the camera is available on an iOS device?
Use UIImagePickerController.isSourceTypeAvailable(.camera) to check if the device has a camera before trying to use it.
Click to reveal answer
intermediate
What delegate protocol must your class conform to when using UIImagePickerController?
Your class must conform to <strong>UIImagePickerControllerDelegate</strong> and <strong>UINavigationControllerDelegate</strong> to handle image picking results and navigation events.
Click to reveal answer
beginner
Why is it important to dismiss UIImagePickerController after picking an image?
Dismissing UIImagePickerController returns control to your app's interface and prevents the picker from blocking user interaction.
Click to reveal answer
Which source type allows users to select photos from their library?
A.camera
B.photoLibrary
C.savedPhotosAlbum
D.video
✗ Incorrect
The .photoLibrary source type lets users pick images or videos from their photo library.
What must you do before accessing the camera in your app?
AEnable background modes
BRequest microphone permission
CAdd NSCameraUsageDescription in Info.plist
DNothing special is needed
✗ Incorrect
You must add NSCameraUsageDescription in Info.plist to explain why your app needs camera access.
Which delegate method handles the event when a user finishes picking an image?