Apple requires that, if we use the camera or access the camera roll, we must let the user know that we are doing so and why. If you fail to do this, your code regarding the camera will not work and your app will be rejected when you submit it. Let's take care of this now.
Open the Info.plist
file and add the following two keys by hovering over any key and hitting the plus icon for the first key and then repeating for the second key:
- NSPhotoLibraryUsageDescription
- NSCameraUsageDescription
For each key's value, enter anything you want as an alert that the user will see. In the following example, the value is set as The app uses your camera to take pictures
:
Please make sure if you are submitting this to the store that you put in the appropriate verbiage. This verbiage is seen by the user as well as Apple. Let's build and run the project by hitting the Play button (or using cmd + R). You should now be able to get a photo from the photo library or use the camera.
Once you have...