Config

@objc(UAConfig)
public class Config : 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: LogLevel
  • The log level used for production apps. Defaults to error.

    Declaration

    Swift

    @objc
    public var productionLogLevel: LogLevel
  • 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

    @objc
    public var enabledFeatures: Features
  • 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]
  • 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]
  • Whether to suppress console error messages about missing allow list entries during takeOff.

    Defaults to false.

    Declaration

    Swift

    @objc
    public var suppressAllowListError: Bool
  • 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
  • Dictionary of custom config values.

    Declaration

    Swift

    @objc
    public var customConfig: [AnyHashable : Any]
  • 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 false.

    Declaration

    Swift

    @objc
    public var requireInitialRemoteConfigEnabled: Bool
  • The Airship chat API URL.

    Declaration

    Swift

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

    Declaration

    Swift

    @objc
    public var chatWebSocketURL: String?
  • 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: LogLevel { get }

    Return Value

    The resolved log level.

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

    Declaration

    Swift

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

    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?) -> Config

    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() -> Config

    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

    @objc
    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.