Getting permission to use the camera or photo library

As we mentioned earlier, Apple stipulates that your app must inform the user if it wishes to access the camera or photo library. If you don't do this, your app will be rejected and will not be allowed on the app store.

Follow these steps:

  1. Click Info.plist in the Project navigator to display a list of keys. Move your mouse pointer over any existing key and click the + button, as follows:

  1. A field should appear, allowing you to enter an additional key, as follows:

  1. Enter the following keys:
NSPhotoLibraryUsageDescription
NSCameraUsageDescription
  1. For each key's value, enter a string that explains to the user why you wish to use the camera or photo library, as shown in the following screenshot:

  1. Build and run the project. Go to the Restaurant Detail screen and tap the Add Photo button. You should see the following alert:

  1. Tap OK. The image picker will appear, as follows:

  1. Select a picture. You will see the following output:

  1. Tapping any filter in the collection view will apply its effect to the main picture. You can use the Cancel button to dismiss the Photo Filter screen and return to the Restaurant Detail screen. However, note that you can't use the Save button yet; you'll implement its functionality in the next two chapters.

The implementation of the Photo Filter screen is now complete. Awesome!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.34.39