UAirship
@interface UAirship : NSObject
UAirship manages the shared state for all Airship services. [UAirship takeOff:] should be
called from within your application delegate’s application:didFinishLaunchingWithOptions:
method
to initialize the shared instance.
-
The application configuration.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UARuntimeConfig *_Nonnull config;
Swift
var config: UARuntimeConfig { get }
-
The default action registry.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UAActionRegistry *_Nonnull actionRegistry;
Swift
var actionRegistry: UAActionRegistry { get }
-
Stores common application metrics such as last open.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UAApplicationMetrics *_Nonnull applicationMetrics;
Swift
var applicationMetrics: UAApplicationMetrics { get }
-
This flag is set to
YES
if the application is set up with the “remote-notification” background modeDeclaration
Objective-C
@property (nonatomic, readonly) BOOL remoteNotificationBackgroundModeEnabled;
Swift
var remoteNotificationBackgroundModeEnabled: Bool { get }
-
A user configurable UAJavaScriptCommandDelegate.
NOTE: this delegate is not retained.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<UAJavaScriptCommandDelegate> javaScriptCommandDelegate;
Swift
weak var javaScriptCommandDelegate: UAJavaScriptCommandDelegate? { get set }
-
The channel capture utility.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UAChannelCapture *_Nonnull channelCapture;
Swift
var channelCapture: UAChannelCapture { get }
-
A user configurable deep link delegate.
NOTE: this delegate is not retained.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<UADeepLinkDelegate> deepLinkDelegate;
Swift
weak var deepLinkDelegate: UADeepLinkDelegate? { get set }
-
The URL allow list used for validating URLs for landing pages, wallet action, open external URL action, deep link action (if delegate is not set), and HTML in-app messages.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UAURLAllowList *_Nonnull URLAllowList;
Swift
var urlAllowList: UAURLAllowList { get }
-
Analytics instance.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UAAnalytics *_Nonnull analytics;
Swift
var analytics: UAAnalytics { get }
-
Locale instance.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UALocaleManager *_Nonnull locale;
Swift
var locale: UALocaleManager { get }
-
Global data collection flag. Enabled by default, unless
UAConfig.dataCollectionOptInEnabled
is set toYES
on the first run.When disabled, the device will stop collecting and sending data for named user, events, tags, attributes, associated identifiers, and location from the device.
Push notifications will continue to work only if
UAPush.pushTokenRegistrationEnabled
has been explicitly set toYES
, otherwise it will default to the current state ofisDataCollectionEnabled
.Note
To disable by default, set theUAConfig.dataCollectionOptInEnabled
flag toYES
on the first run.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isDataCollectionEnabled) BOOL dataCollectionEnabled;
Swift
var isDataCollectionEnabled: Bool { get set }
-
Enables or disables logging. Logging is enabled by default, though the log level must still be set to an appropriate value.
Declaration
Objective-C
+ (void)setLogging:(BOOL)enabled;
Swift
class func setLogging(_ enabled: Bool)
Parameters
enabled
If
YES
, console logging is enabled. -
Sets the log level for the Airship library. The log level defaults to
UALogLevelDebug
for development apps, andUALogLevelError
for production apps (when the inProduction AirshipConfig flag is set toYES
). Values set with this method prior totakeOff
will be overridden during takeOff.Declaration
Objective-C
+ (void)setLogLevel:(UALogLevel)level;
Swift
class func setLogLevel(_ level: UALogLevel)
Parameters
level
The desired
UALogLevel
value. -
Enables or disables logging implementation errors with emoji to make it stand out in the console. It is enabled by default, and will be disabled for production applications.
Declaration
Objective-C
+ (void)setLoudImpErrorLogging:(BOOL)enabled;
Swift
class func setLoudImpErrorLogging(_ enabled: Bool)
Parameters
enabled
If
YES
, loud implementation error logging is enabled.
-
Initializes UAirship and performs all necessary setup. This creates the shared instance, loads configuration values, initializes the analytics/reporting module and creates a UAUser if one does not already exist.
This method must be called from your application delegate’s
application:didFinishLaunchingWithOptions:
method, and it may be called only once.Warning
takeOff:
must be called on the main thread. This method will throw anUAirshipTakeOffMainThreadException
if it is run on a background thread.Declaration
Objective-C
+ (void)takeOff:(nullable UAConfig *)config;
Swift
class func takeOff(_ config: UAConfig?)
Parameters
config
The populated UAConfig to use.
-
Simplified
takeOff
method that usesAirshipConfig.plist
for initialization.Declaration
Objective-C
+ (void)takeOff;
Swift
class func takeOff()
-
Returns the
UAirship
instance.Declaration
Objective-C
+ (null_unspecified UAirship *)shared;
Swift
class func shared() -> UAirship!
Return Value
The
UAirship
instance. -
Returns the
UANamedUser
instance.Declaration
Objective-C
+ (null_unspecified UANamedUser *)namedUser;
Swift
class func namedUser() -> UANamedUser!
Return Value
The
UANamedUser
instance. -
Returns the default
UAAnalytics
instance.Declaration
Objective-C
+ (null_unspecified UAAnalytics *)analytics;
Swift
class func analytics() -> UAAnalytics!
Return Value
The
UAAnalytics
instance.