Enable Media

Photo And Video Messages

To allow access to photo library, iOS requires the Photo Library Usage Description. Add the following key value pair in the app’s Info.plist, or skip this step if the key already exists.

<key>NSPhotoLibraryUsageDescription</key>
<string>My App needs access to photos library to let you share your photos with friends</string>

Edit the description string as appropriate for your app.

The next step is to add media as an input type to support both photo and video messages. To support only photo or video messages, only add photo or video.

InputTypes.add(.media)

The SDK also supports direct camera access, allowing users to take photos without leaving your app. Camera access must be enabled for this feature: add Camera Usage Description to your app’s Info.plist unless it already exists:

<key>Camera Usage Description</key>
<string>My App needs access to camera to let you capture and share with your friends</string>

Then enable the feature for photo and/or video messages by adding their respective input types. To support both, use mediaCapture, or use photoCapture or videoCapture to exclude the other.

InputTypes.add(.mediaCapture)

Note that iOS will ask the user for permission to access the media library and/or camera the first time the user attempts to use this feature.

GIF Messages

The SDK supports sending GIF messages from Giphy. To enable this support, you need to register your app on Giphy in order to receive an API key. Once you have the API key, add the giphy input type with it:

let key = "myAPIKey" // The API key obtained from Giphy
InputTypes.add(.giphy(key))