Permissions Plugin Guide
Permissions Plugin Guide
The Permissions plugin is an optional module that handles privacy-sensitive iOS operations on behalf of the SDK: Camera, Microphone, Contacts, and Photo Library access. The StreamLayer SDK never calls Apple's permission APIs directly — it delegates every status check, authorization request, contact fetch, photo enumeration, and camera capture session to this plugin.
Install the plugin only if your integration uses features that need these capabilities:
| Feature | Permissions required |
|---|---|
| Chat photo picker | Photo Library |
| Chat live camera input | Camera |
| Watch Party audio session | Microphone |
| Watch Party video session | Microphone + Camera |
| Addressbook / Who's Watching / Watch Party Invites | Contacts |
If your integration does not use any of these features, the plugin is not required and the SDK will operate normally without it.
Installation
– Install latest version of the StreamLayer Plugins package.
– Add StreamLayerSDKPluginsPermissions to your project's Frameworks, Libraries and Embedded Content section.
Info.plist Keys
iOS requires a usage-description string in your app's Info.plist for every permission type your app requests. Add only the keys that apply to the features you enable:
| Key | Required for |
|---|---|
NSCameraUsageDescription | Chat camera input, Watch Party video |
NSMicrophoneUsageDescription | Watch Party audio / video |
NSContactsUsageDescription | Addressbook, Watch Party invites, Who's Watching |
NSPhotoLibraryUsageDescription | Chat photo picker |
If a required key is missing, iOS terminates the app the first time the corresponding permission is requested. Add the keys before enabling the feature.
Registration
Register the plugin before configuring the SDK — the first SDK call that queries a permission will use whatever plugin is registered at that moment.
import StreamLayerSDKPluginsPermissions
class ViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
configureSLPermissionsPlugin()
}
...
private func configureSLPermissionsPlugin() {
let plugin = SLRPermissionsPlugin()
StreamLayer.registerPermissionsPlugin(plugin)
}
}SLRPermissionsPlugin is retained by the SDK after registration; you do not need to hold a reference in your view controller or application delegate.
Opting Out of a Permission
To disable a specific feature and avoid its permission prompt, use the corresponding SDK configuration flag instead of customizing the plugin. For example, to disable Contacts:
StreamLayer.config.phoneContactsSyncEnabled = falseSee the Contact Syncing Guide for details.
Updated 2 days ago
