Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
iOS Documentation
SDLAlert

SDLAlert Class Reference

Section Contents

Overview

Shows an alert which typically consists of text-to-speech message and text on the display. Either alertText1, alertText2 or TTSChunks needs to be set or the request will be rejected.

If connecting to SDL Core v.6.0+, the alert can be canceled programmatically using the cancelID. Canceling will not dismiss the alert’s speech - only the modal view will be dismissed. On older versions of SDL Core, the alert will persist until the user has interacted with the alert or the specified timeout has elapsed.

@since SDL 1.0

-initWithAlertText:softButtons:playTone:ttsChunks:alertIcon:cancelID:

Convenience init for creating a modal view with text, buttons, and optional sound cues.

Objective-C

- (nonnull instancetype)
    initWithAlertText:(nullable NSString *)alertText
          softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons
             playTone:(BOOL)playTone
            ttsChunks:(nullable NSArray<SDLTTSChunk *> *)ttsChunks
            alertIcon:(nullable SDLImage *)icon
             cancelID:(UInt32)cancelID;

Swift

init(alertText: String?, softButtons: [SDLSoftButton]?, playTone: Bool, ttsChunks: [SDLTTSChunk]?, alertIcon icon: SDLImage?, cancelID: UInt32)

Parameters

alertText

The string to be displayed in the first field of the display

softButtons

Soft buttons to be displayed

playTone

Whether the alert tone should be played before the TTS (if any) is spoken

ttsChunks

Speech or a sound file to be played when the alert shows

cancelID

An ID for this specific alert to allow cancellation through the CancelInteraction RPC

icon

Image to be displayed in the alert

Return Value

An SDLAlert object

-initWithTTSChunks:playTone:

Convenience init for creating a sound-only alert.

Objective-C

- (nonnull instancetype)initWithTTSChunks:
                            (nullable NSArray<SDLTTSChunk *> *)ttsChunks
                                 playTone:(BOOL)playTone;

Swift

init(ttsChunks: [SDLTTSChunk]?, playTone: Bool)

Parameters

ttsChunks

Speech or a sound file to be played when the alert shows

playTone

Whether the alert tone should be played before the TTS is spoken

Return Value

An SDLAlert object

-initWithAlertText1:alertText2:alertText3:softButtons:playTone:ttsChunks:duration:progressIndicator:alertIcon:cancelID:

Convenience init for setting all alert parameters.

Objective-C

- (nonnull instancetype)
    initWithAlertText1:(nullable NSString *)alertText1
            alertText2:(nullable NSString *)alertText2
            alertText3:(nullable NSString *)alertText3
           softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons
              playTone:(BOOL)playTone
             ttsChunks:(nullable NSArray<SDLTTSChunk *> *)ttsChunks
              duration:(UInt16)duration
     progressIndicator:(BOOL)progressIndicator
             alertIcon:(nullable SDLImage *)icon
              cancelID:(UInt32)cancelID;

Swift

init(alertText1: String?, alertText2: String?, alertText3: String?, softButtons: [SDLSoftButton]?, playTone: Bool, ttsChunks: [SDLTTSChunk]?, duration: UInt16, progressIndicator: Bool, alertIcon icon: SDLImage?, cancelID: UInt32)

Parameters

alertText1

The first line of the alert

alertText2

The second line of the alert

alertText3

The third line of the alert

softButtons

Buttons for the alert

playTone

Whether the alert tone should be played before the TTS (if any) is spoken

ttsChunks

An array of text chunks to be spoken or a prerecorded sound file

duration

The duration of the displayed portion of the alert, in milliseconds

progressIndicator

Whether an animation indicating that loading of a feature is progressing should be shown

cancelID

An ID for this specific alert to allow cancellation through the CancelInteraction RPC

icon

Image to be displayed in the alert

Return Value

An SDLAlert object

alertText1

The first line of the alert text field.

@discussion At least either alertText1, alertText2 or ttsChunks need to be provided. @discussion If supported, the displayCapabilities will have a TextField with a name of alertText1.

String, Optional, Max length 500 chars @since SDL 1.0

Objective-C

@property (nonatomic, strong, nullable) NSString *alertText1;

Swift

var alertText1: String? { get set }

alertText2

The second line of the alert text field.

@discussion At least either alertText1, alertText2 or ttsChunks need to be provided. @discussion If supported, the displayCapabilities will have a TextField with a name of alertText2

String, Optional, Max length 500 chars @since SDL 1.0

Objective-C

@property (nonatomic, strong, nullable) NSString *alertText2;

Swift

var alertText2: String? { get set }

alertText3

The optional third line of the alert text field.

@discussion If supported, the displayCapabilities will have a TextField with a name of alertText3

String, Optional, Max length 500 chars @since SDL 2.0

Objective-C

@property (nonatomic, strong, nullable) NSString *alertText3;

Swift

var alertText3: String? { get set }

ttsChunks

An array of text chunks to be spoken or a prerecorded sound file.

@discussion At least either alertText1, alertText2 or ttsChunks need to be provided.

Array of SDLTTSChunk, Optional, Array length 1 - 100

@since SDL 1.0

Objective-C

@property (nonatomic, strong, nullable) NSArray<SDLTTSChunk *> *ttsChunks;

Swift

var ttsChunks: [SDLTTSChunk]? { get set }

duration

The duration of the displayed portion of the alert, in milliseconds. Typical timeouts are 3 - 5 seconds. If omitted, the timeout is set to a default of 5 seconds.

Integer, Optional, Min value: 3000, Max value: 10000

@since SDL 1.0

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLInt> *duration;

Swift

var duration: (NSNumber & SDLInt)? { get set }

playTone

Whether the alert tone should be played before the TTS (if any) is spoken. If omitted or set to false, no tone is played.

Boolean, Optional

@since SDL 1.0

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLBool> *playTone;

Swift

var playTone: (NSNumber & SDLBool)? { get set }

progressIndicator

If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing (e.g. a spinning wheel or hourglass, etc.).

Boolean, Optional

@since SDL 2.0

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLBool> *progressIndicator;

Swift

var progressIndicator: (NSNumber & SDLBool)? { get set }

softButtons

Buttons for the displayed alert. If omitted on supported displays, the displayed alert shall not have any buttons.

Array of SDLSoftButton, Optional, Array size 0 - 4

@since SDL 2.0

Objective-C

@property (nonatomic, strong, nullable) NSArray<SDLSoftButton *> *softButtons;

Swift

var softButtons: [SDLSoftButton]? { get set }

cancelID

An ID for this specific alert to allow cancellation through the CancelInteraction RPC.

Integer, Optional

See

SDLCancelInteraction @since SDL 6.0

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLInt> *cancelID;

Swift

var cancelID: (NSNumber & SDLInt)? { get set }

alertIcon

Image to be displayed in the alert. If omitted on supported displays, no (or the default if applicable) icon should be displayed.

SDLImage, Optional @since SDL 6.0

Objective-C

@property (nonatomic, strong, nullable) SDLImage *alertIcon;

Swift

var alertIcon: SDLImage? { get set }
View on GitHub.com
Previous Section Next Section