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
iOS Documentation
SDLAlertView

SDLAlertView Class Reference

Section Contents

Overview

Undocumented

defaultTimeout

Set this to change the default timeout for all alerts. If a timeout is not set on an individual alert object (or if it is set to 0.0), then it will use this timeout instead. See timeout for more details. If this is not set by you, it will default to 5 seconds. The minimum is 3 seconds, the maximum is 10 seconds. If this is set below the minimum, it will be capped at 3 seconds. If this is set above the maximum, it will be capped at 10 seconds. Please note that if a button is added to the alert, the defaultTimeout and timeout values will be ignored.

Objective-C

@property (class, nonatomic) NSTimeInterval defaultTimeout;

Swift

class var defaultTimeout: TimeInterval { get set }

text

The primary line of text for display on the alert. If fewer than three alert lines are available on the head unit, the screen manager will automatically concatenate some of the lines together.

Objective-C

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

Swift

var text: String? { get set }

secondaryText

The secondary line of text for display on the alert. If fewer than three alert lines are available on the head unit, the screen manager will automatically concatenate some of the lines together.

Objective-C

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

Swift

var secondaryText: String? { get set }

tertiaryText

The tertiary line of text for display on the alert. If fewer than three alert lines are available on the head unit, the screen manager will automatically concatenate some of the lines together.

Objective-C

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

Swift

var tertiaryText: String? { get set }

timeout

Timeout in seconds. Defaults to 0, which will use defaultTimeout. If this is set below the minimum, it will be capped at 3 seconds. Minimum 3 seconds, maximum 10 seconds. If this is set above the maximum, it will be capped at 10 seconds. Defaults to 0. Please note that if a button is added to the alert, the defaultTimeout and timeout values will be ignored.

Objective-C

@property (nonatomic) NSTimeInterval timeout;

Swift

var timeout: TimeInterval { get set }

audio

Text spoken, file(s) played, and/or tone played when the alert appears

Objective-C

@property (nonatomic, copy, nullable) SDLAlertAudioData *audio;

Swift

@NSCopying var audio: SDLAlertAudioData? { get set }

showWaitIndicator

If supported, the alert GUI will display some sort of indefinite waiting / refresh / loading indicator animation. Defaults to NO.

Objective-C

@property (nonatomic) BOOL showWaitIndicator;

Swift

var showWaitIndicator: Bool { get set }

softButtons

Soft buttons the user may select to perform actions. Only one SDLSoftButtonState per object is supported; if any soft button object contains multiple states, an exception will be thrown.

Objective-C

@property (nonatomic, copy, nullable) NSArray<SDLSoftButtonObject *> *softButtons;

Swift

var softButtons: [SDLSoftButtonObject]? { get set }

icon

An artwork that will be displayed when the icon appears. This will be uploaded prior to the appearance of the alert if necessary. This will not be uploaded if the head unit does not declare support for alertIcon.

Objective-C

@property (nonatomic, copy, nullable) SDLArtwork *icon;

Swift

@NSCopying var icon: SDLArtwork? { get set }

-init

Undocumented

Objective-C

- (instancetype)init NS_DESIGNATED_INITIALIZER;

Swift

init()

-initWithText:buttons:

Initialize a basic alert with a message and buttons

Objective-C

- (nonnull instancetype)initWithText:(nonnull NSString *)text
                             buttons:(nonnull NSArray<SDLSoftButtonObject *> *)
                                         softButtons;

Swift

convenience init(text: String, buttons softButtons: [SDLSoftButtonObject])

Parameters

text

The primary line of text for display on the alert

softButtons

Soft buttons the user may select to perform actions

-initWithText:secondaryText:tertiaryText:timeout:showWaitIndicator:audioIndication:buttons:icon:

Initialize a alert with a text, image, buttons and sound

Objective-C

- (nonnull instancetype)
         initWithText:(nullable NSString *)text
        secondaryText:(nullable NSString *)secondaryText
         tertiaryText:(nullable NSString *)tertiaryText
              timeout:(nullable NSNumber<SDLFloat> *)timeout
    showWaitIndicator:(nullable NSNumber<SDLBool> *)showWaitIndicator
      audioIndication:(nullable SDLAlertAudioData *)audio
              buttons:(nullable NSArray<SDLSoftButtonObject *> *)softButtons
                 icon:(nullable SDLArtwork *)icon;

Swift

convenience init(text: String?, secondaryText: String?, tertiaryText: String?, timeout: (NSNumber & SDLFloat)?, showWaitIndicator: (NSNumber & SDLBool)?, audioIndication audio: SDLAlertAudioData?, buttons softButtons: [SDLSoftButtonObject]?, icon: SDLArtwork?)

Parameters

text

The primary line of text for display on the alert

secondaryText

The secondary line of text for display on the alert

tertiaryText

The tertiary line of text for display on the alert

timeout

Timeout in seconds

showWaitIndicator

If supported, the alert GUI will display some sort of indefinite waiting / refresh / loading indicator animation

audio

Text spoken and/or tone played when the alert appears

softButtons

Soft buttons the user may select to perform actions

icon

An artwork that will be displayed when the icon appears

-cancel

Cancels the alert. If the alert has not yet been sent to the module, it will not be sent. If the alert is already presented on the module, the alert will be immediately dismissed. Canceling an already presented alert will only work if connected to modules supporting RPC Spec v.6.0+. On older versions the alert will not be dismissed.

Objective-C

- (void)cancel;

Swift

func cancel()
View on GitHub.com
Previous Section Next Section