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:

FeaturePermissions required
Chat photo pickerPhoto Library
Chat live camera inputCamera
Watch Party audio sessionMicrophone
Watch Party video sessionMicrophone + Camera
Addressbook / Who's Watching / Watch Party InvitesContacts

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:

KeyRequired for
NSCameraUsageDescriptionChat camera input, Watch Party video
NSMicrophoneUsageDescriptionWatch Party audio / video
NSContactsUsageDescriptionAddressbook, Watch Party invites, Who's Watching
NSPhotoLibraryUsageDescriptionChat 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 = false

See the Contact Syncing Guide for details.