AirshipConfig

@objc(UAConfig)
public class AirshipConfig : NSObject, NSCopying

The Config object provides an interface for passing common configurable values to UAirship. The simplest way to use this class is to add an AirshipConfig.plist file in your app’s bundle and set the desired options.

  • The development app key. This should match the application on go.urbanairship.com that is configured with your development push certificate.

    Declaration

    Swift

    @objc
    public var developmentAppKey: String?
  • The development app secret. This should match the application on go.urbanairship.com that is configured with your development push certificate.

    Declaration

    Swift

    @objc
    public var developmentAppSecret: String?
  • The production app key. This should match the application on go.urbanairship.com that is configured with your production push certificate. This is used for App Store, Ad-Hoc and Enterprise app configurations.

    Declaration

    Swift

    @objc
    public var productionAppKey: String?
  • The production app secret. This should match the application on go.urbanairship.com that is configured with your production push certificate. This is used for App Store, Ad-Hoc and Enterprise app configurations.

    Declaration

    Swift

    @objc
    public var productionAppSecret: String?
  • The log level used for development apps. Defaults to debug.

    Declaration

    Swift

    @objc
    public var developmentLogLevel: AirshipLogLevel
  • The log privacy level used for development apps. Allows logging to public console. Defaults to private.

    Declaration

    Swift

    @objc
    public var developmentLogPrivacyLevel: AirshipLogPrivacyLevel
  • The log level used for production apps. Defaults to error.

    Declaration

    Swift

    @objc
    public var productionLogLevel: AirshipLogLevel
  • The log privacy level used for production apps. Allows logging to public console. Defaults to private.

    Declaration

    Swift

    @objc
    public var productionLogPrivacyLevel: AirshipLogPrivacyLevel
  • Auto pause InAppAutomation on launch. Defaults to false

    Declaration

    Swift

    @objc
    public var autoPauseInAppAutomationOnLaunch: Bool
  • Flag to enable or disable web view inspection on Airship created web views. Applies only to iOS 16.4+. Defaults to false

    Declaration

    Swift

    @objc
    public var isWebViewInspectionEnabled: Bool
  • Allows setting a custom closure for auth challenge certificate validation Defaults to nil

    Declaration

    Swift

    public var connectionChallengeResolver: ChallengeResolveClosure?
  • A closure that can be used to manually recover the channel ID instead of having Airship recover or generate an ID automatically.

    This is a delicate API that should only be used if the application can ensure the channel ID was previously created and by recovering it will only be used by a single device. Having multiple devices with the same channel ID will cause unpredictable behavior.

    When the method is set to restore, the user must provide a previously generated, unique If the closure throws an error, Airship will delay channel registration until a successful execution.

    Declaration

    Swift

    public var restoreChannelID: AirshipChannelCreateOptionClosure?
  • The airship cloud site. Defaults to us.

    Declaration

    Swift

    @objc
    public var site: CloudSite
  • Default enabled Airship features for the app. For more details, see PrivacyManager. Defaults to all.

    Declaration

    Swift

    public var enabledFeatures: AirshipFeature
  • Allows resetting enabled features to match the runtime config defaults on each takeOff Defaults to false

    Declaration

    Swift

    @objc
    public var resetEnabledFeatures: Bool
  • The default app key. Depending on the inProduction status, developmentAppKey or productionAppKey will take priority.

    Declaration

    Swift

    @objc
    public var defaultAppKey: String
  • The default app secret. Depending on the inProduction status, developmentAppSecret or productionAppSecret will take priority.

    Declaration

    Swift

    @objc
    public var defaultAppSecret: String
  • The production status of this application. This may be set directly, or it may be determined automatically if the detectProvisioningMode flag is set to true. If neither inProduction nor detectProvisioningMode is set, detectProvisioningMode will be enabled.

    Declaration

    Swift

    @objc
    public var inProduction: Bool { get set }
  • Apps may be set to self-configure based on the APS-environment set in the embedded.mobileprovision file by using detectProvisioningMode. If detectProvisioningMode is set to true, the inProduction value will be determined at runtime by reading the provisioning profile. If it is set to false (the default), the inProduction flag may be set directly or by using the AirshipConfig.plist file.

    When this flag is enabled, the inProduction will fallback to true for safety so that the production keys will always be used if the profile cannot be read in a released app. Simulator builds do not include the profile, and the detectProvisioningMode flag does not have any effect in cases where a profile is not present. When a provisioning file is not present, the app will fall back to the inProduction property as set in code or the AirshipConfig.plist file.

    Declaration

    Swift

    @objc
    public var detectProvisioningMode: Bool { get set }
  • If enabled, the Airship library automatically registers for remote notifications when push is enabled and intercepts incoming notifications in both the foreground and upon launch.

    Defaults to true. If this is disabled, you will need to register for remote notifications in application:didFinishLaunchingWithOptions: and forward all notification-related app delegate calls to UAPush and UAInbox.

    Declaration

    Swift

    @objc
    public var isAutomaticSetupEnabled: Bool
  • An array of UAURLAllowList entry strings. This url allow list is used for validating which URLs can be opened or load the JavaScript native bridge. It affects landing pages, the open external URL and wallet actions, deep link actions (if a delegate is not set), and HTML in-app messages.

    Note

    See UAURLAllowList for pattern entry syntax.

    Declaration

    Swift

    @objc(URLAllowList)
    public var urlAllowList: [String] { get set }
  • An array ofUAURLAllowList entry strings. This url allow list is used for validating which URLs can load the JavaScript native bridge, It affects Landing Pages, Message Center and HTML In-App Messages.

    Note

    See UAURLAllowList for pattern entry syntax.

    Declaration

    Swift

    @objc(URLAllowListScopeJavaScriptInterface)
    public var urlAllowListScopeJavaScriptInterface: [String]
  • An array of UAURLAllowList entry strings. This url allow list is used for validating which URLs can be opened. It affects landing pages, the open external URL and wallet actions, deep link actions (if a delegate is not set), and HTML in-app messages.

    Note

    See UAURLAllowList for pattern entry syntax.

    Declaration

    Swift

    @objc(URLAllowListScopeOpenURL)
    public var urlAllowListScopeOpenURL: [String] { get set }
  • The iTunes ID used for Rate App Actions.

    Declaration

    Swift

    @objc
    public var itunesID: String?
  • Toggles Airship analytics. Defaults to true. If set to false, many Airship features will not be available to this application.

    Declaration

    Swift

    @objc
    public var isAnalyticsEnabled: Bool
  • The Airship default message center style configuration file.

    Declaration

    Swift

    @objc
    public var messageCenterStyleConfig: String?
  • If set to true, the Airship user will be cleared if the application is restored on a different device from an encrypted backup.

    Defaults to false.

    Declaration

    Swift

    @objc
    public var clearUserOnAppRestore: Bool
  • If set to true, the application will clear the previous named user ID on a re-install. Defaults to false.

    Declaration

    Swift

    @objc
    public var clearNamedUserOnAppRestore: Bool
  • Flag indicating whether channel capture feature is enabled or not.

    Defaults to true.

    Declaration

    Swift

    @objc
    public var isChannelCaptureEnabled: Bool
  • Flag indicating whether delayed channel creation is enabled. If set to true channel creation will not occur until channel creation is manually enabled.

    Defaults to false.

    Declaration

    Swift

    @objc
    public var isChannelCreationDelayEnabled: Bool
  • Flag indicating whether extended broadcasts are enabled. If set to true the AirshipReady NSNotification will contain additional data: the channel identifier and the app key.

    Defaults to false.

    Declaration

    Swift

    @objc
    public var isExtendedBroadcastsEnabled: Bool
  • If set to ‘YES’, the Airship SDK will request authorization to use notifications from the user. Apps that set this flag to false are required to request authorization themselves.

    Defaults to true.

    Declaration

    Swift

    @objc
    public var requestAuthorizationToUseNotifications: Bool
  • If set to true, the SDK will wait for an initial remote config instead of falling back on default API URLs.

    Defaults to true.

    Declaration

    Swift

    @objc
    public var requireInitialRemoteConfigEnabled: Bool
  • The Airship URL used to pull the initial config. This should only be set if you are using custom domains that forward to Airship.

    Declaration

    Swift

    @objc
    public var initialConfigURL: String?
  • The Airship chat API URL.

    Declaration

    Swift

    @objc
    public var chatURL: String?
  • The Airship web socket URL.

    Declaration

    Swift

    @objc
    public var chatWebSocketURL: String?
  • If set to true, the SDK will use the preferred locale. Otherwise it will use the current locale.

    Defaults to false.

    Declaration

    Swift

    @objc
    public var useUserPreferredLocale: Bool
  • If set to true, Message Center will attempt to be restored between reinstalls. If false, the Message Center user will be reset and the Channel will not be able to use the user as an identity hint to recover the past Channel ID.

    Defaults to true.

    Declaration

    Swift

    @objc
    public var restoreMessageCenterOnReinstall: Bool
  • Returns the resolved app key.

    Declaration

    Swift

    @objc
    public var appKey: String { get }

    Return Value

    The resolved app key or an empty string.

  • Returns the resolved app secret.

    Declaration

    Swift

    @objc
    public var appSecret: String { get }

    Return Value

    The resolved app key or an empty string.

  • Returns the resolved log level.

    Declaration

    Swift

    @objc
    public var logLevel: AirshipLogLevel { get }

    Return Value

    The resolved log level.

  • Returns the resolved log privacy level.

    Declaration

    Swift

    public var logPrivacyLevel: AirshipLogPrivacyLevel { get }

    Return Value

    The resolved log privacy level.

  • Creates an instance using the values set in the AirshipConfig.plist file.

    Declaration

    Swift

    @objc(defaultConfig)
    public class func `default`() -> AirshipConfig

    Return Value

    A config with values from AirshipConfig.plist file.

  • Creates an instance using the values found in the specified .plist file.

    Declaration

    Swift

    @objc
    public class func config(contentsOfFile path: String?) -> AirshipConfig

    Parameters

    path

    The path of the specified file.

    Return Value

    A config with values from the specified file.

  • Creates an instance with empty values.

    Declaration

    Swift

    @objc
    public class func config() -> AirshipConfig

    Return Value

    A config with empty values.

  • Creates an instance using the values found in the specified .plist file.

    Declaration

    Swift

    @objc
    public convenience init(contentsOfFile path: String?)

    Parameters

    path

    The path of the specified file.

    Return Value

    A config with values from the specified file.

  • Creates an instance with empty values.

    Declaration

    Swift

    public override init()

    Return Value

    A Config with empty values.

  • Validates the current configuration. In addition to performing a strict validation, this method will log warnings and common configuration errors.

    Declaration

    Swift

    @objc
    public func validate() -> Bool

    Return Value

    true if the current configuration is valid, otherwise false.

  • Validates the current configuration. In addition to performing a strict validation, this method will log warnings and common configuration errors.

    Declaration

    Swift

    public func validate(logIssues: Bool) -> Bool

    Parameters

    logIssues

    true to log issues with the config, otherwise false

    Return Value

    true if the current configuration is valid, otherwise false.