Functions

The following functions are available globally.

  • Method used to extract call information contained in raw push notification payload.

    Declaration

    Swift

    public func queryPushNotificationPayload(_ payload: [AnyHashable : Any]) -> SinchNotificationResult

    Parameters

    payload

    Remote notification payload which was transferred with an Apple Push Notification.

    Return Value

    Result of initial inspection of push notification.

  • Determine whether a push notification payload is carrying a Sinch payload.

    Declaration

    Swift

    public func isSinchPushPayload(_ payload: [AnyHashable : Any]) -> Bool

    Parameters

    payload

    Payload that was received in push notification

    Return Value

    true if payload is identified as Sinch, false otherwise

Factory methods

  • Instantiate a new client. The creation of the client may fail, as a result of input parameters being nil or not matching length criteria, or because of internal failure when creating application support directory. If any failure occurs, the method will throw.

    Throws

    if creation of the client fails

    See also

    SinchClient

    Declaration

    Swift

    public func client(withApplicationKey key: String,
                       environmentHost: String,
                       userId: String) throws -> SinchClient

    Parameters

    key

    Application Key identifying the application

    environmentHost

    Host for base URL for the Sinch RTC API environment to be used. E.g. ‘ocra.api.sinch.com’

    userId

    ID of the local user

    Return Value

    The newly instantiated client.

Factory methods with support for CLI / PSTN

  • Instantiate a new client with a CLI (may be used for PSTN-terminated calls). The creation of the client may fail, as a result of input parameters being nil or not matching length criteria, or because of internal failure when creating application support directory. If any failure occurs, the method will throw.

    Throws

    if creation of the client fails

    See also

    SinchClient

    Declaration

    Swift

    public func client(withApplicationKey key: String,
                       environmentHost: String,
                       userId: String,
                       cli: String) throws -> SinchClient

    Parameters

    key

    Application Key identifying the application

    environmentHost

    Host for base URL for the Sinch RTC API environment to be used. E.g. ‘ocra.api.sinch.com’

    userId

    ID of the local user

    cli

    Caller-ID when terminating calls to PSTN. Must be a valid phone number.

    Return Value

    The newly instantiated client.

Push Notifications

  • Instantiate a new SinchManagedPush instance to enable Push Notifications managed by the Sinch SDK and platform. When using managed push notifications, push notifications will be sent by the Sinch platform provided that Apple Push Notification Certificates for your application have been uploaded to Sinch.

    See also

    SinchAPSEnvironment

    Declaration

    Swift

    public func managedPush(forAPSEnvironment environment: APSEnvironment) -> SinchManagedPush

    Parameters

    environment

    Specification of which Apple Push Notification Service environment the application is bound to (via code signing and Provisioning Profile).

Miscellaneous

  • Set a log callback block.

    The Sinch SDK will emit all it’s logging by invoking the specified block.

    Caution: Only log messages with severity level LogSeverity.warning or higher to the console in release builds, to avoid flooding the device console with debugging messages.

    Declaration

    Swift

    public func setLogCallback(_ callback: @escaping LogCallback)

    Parameters

    callback

    log callback block. IMPORTANT: The block may be invoked on any thread / GCD queue.

  • Specify the data protection type (NSFileProtectionType) for the files created and used by the Sinch SDK. If not set specifically, the files will inherit the data protection level defined in your Application.

    Method should be called before creation any instances of Sinch SDK classes, e.g. SINClient, SinchManagedPush etc.

    Declaration

    Swift

    public func setDataProtectionType(_ type: FileProtectionType)

    Parameters

    type

    the data protection type applied to the files created by the Sinch SDK.

  • The Sinch SDK will emit all callbacks of SinchClientDelegate, SinchCallClientDelegate, SinchCallDelegate, SinchAudioControllerDelegate on the DispatchQueue specified with this method.

    Note that SinchManagedPush delegate callbacks will still occur on any thread, because incoming VoIP pushes have to be reported to CallKit synchronously.

    When not explicitly set, the callback queue defaults to the main queue.

    • param queue: the DispatchQueue where callbacks will be invoked.

    Declaration

    Swift

    public func setCallbackQueue(_ queue: DispatchQueue)
  • Declaration

    Swift

    public func getCallbackQueue() -> DispatchQueue

    Return Value

    the callback queue set via SinchRTC.setCallbackQueue(), or the main queue if it hasn’t been set explicitly.

  • Returns the Sinch SDK version.

    Declaration

    Swift

    public func version() -> String